I have a form to record date of planned exam, and a field to calculate the # of days till the exam date comparing to hidden field with [date]. User can change exam date, but I need to re-calculate the # of days update with the new value.
Also, Can I update the hidden field with the current date during the form update?
You need to use jQuery or create a custom PHP snippet to use in the frm_pre_update_entry hook. https://formidableforms.com/knowledgebase/frm_pre_update_entry/
Default values calculate only if the field is empty. After it has been populated there is no longer a need for a default value.
From the Formidable KnowledgeBase:
Note:
Default values will be used when a new entry is created or when a field is conditionally shown.
Default values will not replace submitted values when you edit an entry, even if the submitted value is empty.
Now that I think of it, if I had a requirement to update a hidden field on every update, I would use jQuery and embed the code in the After Fields area on the form's Customize HTML page and leave the hidden field's default value empty. If you're calculating the value on entry creation and update, there's no need for the default value.
Please login or Register to submit your answer
I have the same problem I need to find a solution for. Would be nice if there was an option to keep the value for any field when hidden.