I am trying to have repeating fields in a long form, such as name, populate with a default value of the first instance of that field. The first field which populates the defaults of the rest of the fields is typed in by a user, not a lookup and not coming from another form. After typing into the first field, the rest of the similar fields should display a default value, and that default value should be what the user typed into the first field.
By setting the default values of subsequent fields to the first field's token, the initial blank first field is propagated to the rest of the form defaults. The default values are being populated immediately when the form loads. Typing into the first field does not update the rest of the defaults.
Is there a way to delay the default values propagation until after the first fields are complete, or barring that is there a way to have the defaults refresh on a timer?
Question
Question
Form Field Default Propagation Refresh
Replies
Hello,
Default values in Forms do not really work this way; they are based on the values saved to the process meaning even if it were delayed/refreshed, they wouldn't change.
Basically, you're getting what Forms already saved, not the "current" field values; these dataset values won't actually change until a user submits the form and the changes are committed.
Depending on what your exact needs are, it is possible that you could use Functions, which update in real-time, but you would probably see some unexpected behavior if the user is going to edit the values in the other fields.
For example, if you edit one, then go back and change the first field, it would apply the "default" again and you'd lose your changes. Also, they're in a collection, my experience has been that the underlying scripts for the functions "fire" again each time a row is added or removed and you lose your changes.
If that is an issue, then custom JavaScript might be the only the way to go.
- Attach an event handler to your default fields
- When the field changes
- Locate the target fields and if they are blank, apply the "default" value