Ticket #566 (assigned new feature)
jForms: support of <repeat>
|Reported by:||laurentj||Owned by:||obs|
|Hosting Provider:||Blocked By:|
Sometimes, in a form, we need to duplicate some fields dynamically. A typical example is to have upload fields to attach a file to an article. The number of this field depends of the need of the user, so there are some buttons to add dynamically a new upload field, or to remove an upload field.
<repeat> could bring this feature. Example:
<repeat ref="uploadedfile" min="1" max="5" count="3" addlabel="Add a new file" removelabel="remove this file"> <label>...</label> <input ref="filelabel"><label>title for the file</label></input> <upload ref="file"><label>the file to upload</label></input> <!-- <datasource dao="".../> --> </repeat>
the input and the upload elements will be repeated 3 times. But if we indicate a datasource element, there will have as many input/upload files as records given by the datasource.
the uplodadedfile data will be an array with data of each input/upload "lines".