The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Conditionally require a field for two different forms
Hello everyone,
I have two forms on a web page (in two different languages) and I tried to make a field required only when a certain value is selected in another field. I found the instructions on this page: https://formidableforms.com/knowledgebase/frm_validate_field_entry/#kb-conditionally-require-a-field.
I have inputed these lines of code to my themes functions.php and inserted the field IDs for one of the forms and it worked great!
I don't have much experience with coding, so I just copied the same lines of code beneath the first lines of code and changed the field IDs for the second form. After I saved the changes in the functions.php, the whole page stoped working. So I deleted the second lines of code and it started working again.
So my question is, is there a way to add this filter for two different forms? I have attached a print screen of the code I inputed when the page stoped working.
Thank you for your help.
Best regards,
Alen
January 30, 2017 at 7:25 pm
The second parameter of the "add filter()" has to be unique. So in your second add filter, change "conditionally_require_a_field" to "conditionally_require_a_field_2". Note the "_2" I've added to the second filter to make it unique.
Discussion closed.