• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Disable validation in Javascript

Disable validation in Javascript 8 years 3 weeks ago #36702

  • tomr5
  • tomr5's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Am a bit struggling here I am migrating from BreezingFoms to RSForms Pro.

How do you disable a validation on a dropdown field which is sometimes hidden by the value of the label of another dropdown? ( In BreezingFoms when you turn off a field, the validation is disabled ;)

I have two dropdowns both filled from two database tables.
Both have a validation that the are required
If the label of the selection in the first dropdown as a specific word then the second dropdown has to be shown.
And if not the second dropdown has to be hidden.

Got it working with javascript except for the fact that the validation of the second dropdown is ALWAYS active. I want to disable the validation when the second dropdown is hidden.

I read through the documentation and forum but clearly I am missing something because I am not able to disable the validation in javascript.

In CSS and Javascript ( under Javascript ;) )

<script type="text/javascript">
function displayVereniging() {
   var mySearchString = 'vereniging';
   var mySelection = document.getElementById("cursus").options[document.getElementById("cursus").selectedIndex].innerHTML;
 
   if(mySelection.indexOf( mySearchString) !== -1) 
   {
       document.querySelector('.rsform-block-vereniging').style.display = "";
   }
   else {
       document.querySelector('.rsform-block-vereniging').style.display = "none";
   } 
}
 window.onload = function() {
    displayVereniging();
};
 </script>
Last Edit: 8 years 2 weeks ago by tomr5. Reason: typos
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!