AnsweredAssumed Answered

Multiple Input Fields generator

Question asked by jzulu2000 on Jan 22, 2008
Latest reply on Jan 22, 2008 by jzulu2000
I needed alfresco to render a single property of type d:text in multiple input fields and I didn't see an easy way of doing this;

For example, I had the Person property in the model, of type d:text and I had to ask for the id, first and last name. Visually, te component had to look like…


<type name="gc:RFC">
      <property name="gc:person">
            <type>d:text</type>
            <mandatory>true</mandatory>
      </property>

——————————————
|         | Id:         _______________   |
|         |                               |
| Person: | First Name: _______________   |
|         |                               |
|         | Last Name:  _______________   |
——————————————



instead of


<type name="gc:RFC">
      <property name="gc:personID">
            <type>d:text</type>
            <mandatory>true</mandatory>
      </property>
      <property name="gc:personFirstName">
            <type>d:text</type>
            <mandatory>true</mandatory>
      </property>
      <property name="gc:personLastName">
            <type>d:text</type>
            <mandatory>true</mandatory>
      </property>

—————————————
| Person Id:         _______________   |
|                                      |
| Person First Name: _______________   |
|                                      |
| Person Last Name:  _______________   |
—————————————


the only way of doing this was creating acustom generator and configure the show-property in the property-sheet to use the custom generator; the problem with this is that not only the person had to be renerer like this; so, we had to create several custom generators, one for each entity.

A better solution was to create a configurable component so we can tell the component type, renderer and label for every input field, so we can combine input text, text areas, lists, etc. This component saves the fields in a single property using the "°" separator, and can be used in properties with multiple = true; in that case, renders a table with columns for every value. This can be used in multi value read-only properties too; in that case, only paints the table with no delete action;

Outcomes