my input disable script is not working correctly in mendix

0
Greetings,  I have this js I did in codepen: https://codepen.io/acoss22/pen/abbXyeQ I tried to the same in Mendix:  code in html snippet:  document.getElementsByClassName('formInputs')[0].addEventListener("click", isClicked); var form = document.getElementsByClassName('formInputs')[0]; var form2 = document.getElementsByClassName('formInputs2')[0]; var inputs = form.getElementsByTagName('input'); var inputs2 = form2.getElementsByTagName('input'); var numberofInputs = form.length; //2 var numberofInputs2 = form2.length; //2 var saveSelected = ""; function isClicked() { for(var i = 0; i < numberofInputs; i++){      if (inputs[i].checked){       saveSelected = inputs[i];      } }   for(var i = 0; i < numberofInputs2; i++)     if(saveSelected.value == "Day")     {         if (inputs2[i].value == "Week" )         {                 inputs2[i].disabled = true;         }        }        }   }  in the 1st radio buttons i have added formInputs as the class in the 2nd radio buttons i have added formInputs2 as the class   For some reason nothing happens in mendix, it doesn’t disable my button.  The desired behaviour is to click on Day on first group of buttons and disable week on the second group of buttons. Where I am failing ?   Thanks in advance,  Ana  
asked
1 answers
2

HI Ana, 

If you are using the html snippet then I would wrap your script in a time out of 100 – 500 ms. Most likely the script is running before the page is fully loaded. 

You can also try this method of implementing a script on a page. 

https://forum.mendix.com/link/questions/97121

 

If that doesn’t work,  can you provide more details on what are you trying to do? Are you trying to disable an a set of checkboxes based on another selection?

 

answered