Is it possible to make a fieldset required? That is, I know I can make each field within a fieldset required, but to do so requires making every field required. I would like to make it so that at least one of the fields is selected before the person can go on and click the Submit button.
Thanks in advance for your help!
Laura
Solved! Go to Solution.
You say this is possible. While it may not have been the right approach for this person, are you able to share how this can be done?
You can use a custom onValidate listener function.
When the person attempts to submit the form, Marketo first executes the native validator and then passes control to your custom validator code. Your code can see if the fieldset contains empty fields and then pop up the validation error accordingly.
The answer is Yes, but before I tell you how to do it, are you sure a fieldset is really what you want? Semantically, a fieldset should hold related fields, but it's sort of like a form within a form. The fields aren't necessarily interdependent. Maybe you actually want a radio button set or checkbox set?
I am actually not sure that I want a fieldset...I tried to set the fields as radio buttons, but it seemed like I wasn't getting anywhere. To create a radio button set or checkbox set, does this require an overarching field and then fields within that? Here is the form that I'm working on. Or do I take one field and then create the values within that? I'm just a little lost on what the best approach would be...Thanks.
This could be done w/3 fields:
Hi Sanford,
My apologies for responding on such an old post. This is the only thread I could find on the subject.
You say this is possible. While it may not have been the right approach for this person, are you able to share how this can be done?
Thank you!
You say this is possible. While it may not have been the right approach for this person, are you able to share how this can be done?
You can use a custom onValidate listener function.
When the person attempts to submit the form, Marketo first executes the native validator and then passes control to your custom validator code. Your code can see if the fieldset contains empty fields and then pop up the validation error accordingly.
Thank you very much, Sanford! I'll take a look at it.