Default values resetting when updating a current entry?

By: Mo Adam | Asked: 10/17/2024
ForumsCategory: How-toDefault values resetting when updating a current entry?
Mo Adam asked 1 month ago
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?
Doug Tree replied 1 month ago

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.

1 Answers
Victor Font answered 1 month ago
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.
Victor Font replied 1 month ago

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.

Victor Font replied 1 month ago

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.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right