conditionally required text box -...

User 2293608 Photo


Registered User
2 posts

Hi All,

I have a form that has some conditionally displayed fields. When the condition is set and the field displays I want it to be a required field. If I do it now the form wont submit for people who do not display the field and therefore don't have the option to fill in the required field. Does anyone have a work around in the code or could suggest one for this?

Cheers for your suggestions.

Adrian
User 2147626 Photo


Ambassador
2,958 posts

If I understand your problem, there should be no problem. :D

If I create a form with say, checkboxes and a text field. Then make the text field 'required', and make it only display if checkbox3 is selected, then it works.

You can select checkbox 1 and/or 2 and the form will submit.
You can select checkbox3, but cannot submit the form unless something is in the textbox.

The 'required field will not display unless the condition is met, and will not prevent your form from being submitted. The only time the 'required' field will display is if the condition is met. Then the 'required' field will also have to be met.

I just tested this again, and it works. Check all your conditionals and make sure you haven't crossed something up. It should work for you. Let us know if you still have problems.
Graphics for the web, email, blogs and more!
-------------------------------------
https://sadduck.com
User 2293608 Photo


Registered User
2 posts

You are right. I had it set up slightly wrong and now it all works. Fantastic.

Thanks for the help Gunsmoke
User 2147626 Photo


Ambassador
2,958 posts

Glad you got it working. Have fun! :D
Graphics for the web, email, blogs and more!
-------------------------------------
https://sadduck.com
User 187934 Photo


Senior Advisor
20,271 posts

That conditional logic can cause you to have a condition called confusion.:lol: It's a very powerful.:) Conditions offer the best approach to handling things fast that would otherwise require a ton of coding.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2147626 Photo


Ambassador
2,958 posts

And worse, a ton of thought! :D:D
Graphics for the web, email, blogs and more!
-------------------------------------
https://sadduck.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.