Forums

How To: Set a field to required based on a check box.

arrick 11 Jun, 2015
you can find the form located at http://mwforms.miworksmo.org/hiringevents?chronoform=Hiring_Event_Request&event=page3.

There is a check box labeled "Other" with an id of "s4".
The text box below with an id of "otherSetup" is set to disabled, and is enabled upon "s4" being checked.

I would also like to have the "otherSetup" text field be set to required when the "s4" check box is checked...

I know I should be able to perform this with javascript, but I think I am going about it the wrong way...

Currently I have a "load JavaScript" in the "On page3" setup.

On page3
Load JS
multipage
load css
render html

This code is from the load JS.

window.addEvent('domready', function() {
  $('s4').addEvent('change', function() {
    if ( $('s4').value == 'checked' ) {
       $('otherSetup').setProperty('required', 'required');
       } else {
       $('otherSetup').setProperty('required', 'not required');
          }
  });
});
This topic is locked and no more replies can be posted.