Javacript Tweak


I'd appreciate some help with tweaking a javascript validation script --

function validateBrandRate(formNode){
  var formValidatorInstance = new FormValidator(formNode);
  formValidatorInstance.addRule('nextyearreason','Please indicate why you will not deal with this brand next year','required');
  return formValidatorInstance.validate(); 

Open in new window

I need the script to run only if a checkbox with an ID of sliderLabel is checked.

At the same time, if the checkbox with an ID is checked I need the select with an id of nextyearreason to be enabled; and disabled if the checkbox is not checked.

I think this is two different scripts, an alteration to the first one and a new script for the enable disable.

Thank you
Who is Participating?
Julian HansenConnect With a Mentor Commented:
Take a look at the docs here

Specifically this section:
Specifies a contact element as required and as email address, the latter depending on a checkbox being checked for contacting via email.
   rules: {
     contact: {
       required: true,
       email: {
         depends: function(element) {
           return $("#contactform_email:checked")

Open in new window

garethtnashAuthor Commented:
Thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.