Repeat

The repeat object is used to replicate a number of elements on a form a user specified number of times. It’s useful when the designer may not know how many inputs may be required by the user. So by adding a repeat to the form, and specifying the fields to replicate, the user can then determine the number of times those elements appear dynamically by clicking a button to add an additional row.

An example of how to use Repeat is shown below:

ch7_p36

In this instance we’ve used the repeat object to create a table of parts. The form definition includes twp pulldown menus for Source and Part Number, as well as two textfields for the Description and Quantity which have been included into the repeated object. The text for the repeat has been changed to “Add part”.

Text: The label for the button which adds another row to the form. If left blank it will default to the text ‘Repeat’.

Ids: The field id’s by range that will be duplicated when the repeat object is used.

Remove Header: The header of the repeat is removed by default and the property is usually checked. This means that the all entries of a repeat are included within the repeat. The XML for each is wrapped in the repeats tag.

</xsubmission> 
<repeat_parts></partsFrom></partNumber></repeat_parts>
<repeat_parts></partsFrom></partNumber></repeat_parts>
 <repeat_parts></partsFrom></partNumber></repeat_parts>
</xsubmission>

With the header left in, the original line of the repeat is tagged to the form and not within the repeat itself. So three lines would look like this:

</xsubmission> 
</partsFrom></partNumber>
</repeat_parts></partsFrom></partNumber></repeat_parts>
</repeat_parts></partsFrom></partNumber></repeat_parts>
</xsubmission>

This can be a useful structure in some situations depending on the design of the database or the programming needs for parsing the data after being submitted.

Initial number of open repeats: The number of repeated lines visible on the form when created.  Set to 0 by default, where typically noting is displayed until the user requests the line by clicking the ‘repeat’ button. It is worth noting that the initial number of open repeats also represents the minimum number of repeated rows on the form. So if you default 1 to open, the user must submit the form with at least one repeated line. Maximum number of repeats: The maximum number of repeated lines that can be added to the form

Read-only: The repeat is used for display purposes, lines cannot be added or removed. The repeat needs to be used with a connector to retrieve the data to be displayed

Example of a Read-Only Repeat:

Contact Form Powered By : XYZScripts.com