Can a hidden field's value vary?

User 264425 Photo


Registered User
32 posts

Hi. Can a hidden field's value vary depending on visible field's contents?

My form has a checkbox field with the two choices being "male" or "female". Is there a way to have a hidden field's value vary depending on which box is checked? For instance, if the "male" choice is checked, I would want "WM" in the hidden field's value. And if the "female" choice is checked, I would want "WF" in the hidden field's value. Is this possible? If so, how would I accomplish this? Thanks.

Dave
User 187934 Photo


Senior Advisor
20,190 posts

Hi Dave,
Yes. Add a field to your form and then add some custom js or css to hide the input.
Now use a little bit of JQuery to fill the hidden inputs value based on what's selected.
If you need more info I'll need to see the actual form.
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

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.