3

I have a form in Chronoform where there are two checkboxes, when you select the second checkbox, a hidden DIV becomes visible. Inside this hidden DIV there are 16 more checkboxes. At least one of those checkboxes must be selected to move on.

With the first two checkboxes, I am using class="validate['group[1]']" which works great to force the user to choose between the first two options.

I tried using class="validate['group[2]']" on the checkboxes in the hidden DIV, but if the DIV remains hidden, it is still forcing the validation. So you can't move on, unless you open that DIV and select at least one option.

How do I validate the checkboxes in the hidden DIV only if the hidden DIV is opened?

You can see the form on jsfiddle, but it's not opening like it does with Joomla and Chronoforms, so I may post a second link to a working version of it.

I am open to using custom scripts like jQuery on the server side, if needed.

I'm not a strong coder, so please go easy on me.

  • you can see the form in action here: ryanduffdesign.com/form – Melvins138 Aug 21 '14 at 16:10
  • 1
    You should probably contact the developer of ChromoForms as it's a third party plugin, especially if you have paid for support. They have a forum here also which may be useful chronoengine.com/forums.html – jonboy Aug 22 '14 at 9:06
2

Within your javascript which shows/hides the divs, remove/replace the validate CSS class that is used to determine if a field should be validated.

Of course, you'll want to replace validate-* with something else so you know what to put back when the div is visible.

Not sure if you're using pure javascript, bootstrap or jquery to accomplish the hiding - so no specific code to show you. If you're using bootstrap, there are additional helper events that can assist you in accomplishing this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.