Make repeating fields editable |
Chong-ho (Alex) Yu, Ph.D., MCSE, CNE |
Problem:I created several repeating fields for users to enter or select more than one value. I don't want to use seperate fields to contain multiple values because in order to locate related information users must search through all those fields instead of one field only. I inserted the following tag into the "record_detail.html" for users to edit their own records:
[FMP-REPEATING: partners][FMP-REPEATINGITEM: HTML][/FMP-REPEATING] However, the field becomes read only and all values are printed in one line as the following:
I tried to use check boxes and input fields but they showed only the first one of the original values that were entered by users.Solution:
To show editable text fields with the original repeating values in record_detail.html, first in File Maker Pro you should create several calculation fields to extract different values. For example, if you have a repeating field named "Partner," in which a user can enter more than one partner's name, you can create a calculation field named "Partner2" and enter the following formula into the field property:
|
Use the same procedure to create "Partner3-Partner5." Then insert the following tags in "record_detail.html." The text fields will show all the values that were entered previously rather than just the first one.
Actually the values other than the first one were showed by the calculation fields rather than the repeating field. But if the user edits and submits the record, all values will go to the repeating field. The following is a screenshot of this setup:
When you want to force the user to select values from a pre-defined menu, probably you would use checkboxes rather than text fields. However, checkboxes can show only the first value selected by the user. You can use selection list to overcome this shortcoming.First, on the define valuelists in File Maker Pro, select the value list to be used, then add "None" at the bottom of the list.
Again, create calculation fields to extract data from the repeating field. However, this time use a If-then-else statement as the following. The following statement checks whether the second value of the repeating field is empty. If so, put the string "None" in the calculation field, otherwise, import the value from the repeating field.
|
Use the same statement in other calculation fields to extract other values of the repeating field. Next, insert the following tags into "record_detail.html."
The above tags create selection lists showing the previously selected item. If the user didn't select an item, it will show "None." When the user pulls down the menu, s/he can see all other choices on the value list. Again, the submitted data will go to the repeating field though the display is from the calculation fields. The following picture is a screenshot of this setup:
FMP Tips Contents
|
|