Conditional filling of fields in a form

By: Gilles Deron | Asked: 10/03/2023
ForumsCategory: How-toConditional filling of fields in a form
Gilles Deron asked 1 year ago
Hello,
In a form, is there a way to fill a field with data previously entered in the same form with a condition?
For example: the visitor has entered his billing address, and I also need a delivery address. In order to avoid potential double encoding, I place a checkbox "Delivery address identical to billing address". If this box is checked, the "Delivery address" field will be automatically filled in with the billing address the visitor has just entered.
No double encoding - the visitor is happy
I've found examples of how to use if ... else, but I can't seem to use it with text or address fields.
Any help would be greatly appreciated.
2 Answers
Rob LeVineRob LeVine answered 1 year ago
See this https://formidableforms.com/knowledgebase/javascript-examples/#kb-copy-address-when-checkbox-is-checked
Gilles Deron answered 1 year ago
Thank you very much for your prompt reply. The snippet proposed in the link you provide seems promising, although more complex than my need. I had mentioned delivery and billing addresses as examples. I'd like to be able to copy address fields as well as text fields, name fields or radio button values.


Rob LeVineRob LeVine replied 1 year ago

Regardless of what type of field, you'll need to use javascript/jQuery to do what you need to do. You can conditionally hide and show fields with native Formidable as well as do arithmetic with fields by using the calculations, but if you want to move stuff from one field to another after the form has been displayed, you'll need code like what you see in that example. If you're not comfortable doing it yourself, you can hire a developer here https://formidable-masterminds.com/developers-directory/

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