JS not working on Yes/No element

ontarget

Active Member
Hi I am triggering an onLoad and onChange event on a YesNo element - hideReasonNo(this); via inline js from the /form_X.js file

Basically nothing happens! I set the value for '1' in the js as below

JavaScript:
function hideReasonNo(el)
{
     var elL = el.form.formElements.get('aaa_mentors___available_to_mentor');
     var elM = el.form.formElements.get('aaa_mentors___reason_if_no');

          if (elL.getValue() === '1') {

           elM.hide();
           return;
          
       }
       else {
            elM.show();

       }
}
 
Events work fine on yesno elements for me, although I use 'click' rather than 'change'.

Can you point me at the page?

-- hugh
 
Hi Hugh
Thanks I found the error using the console - there was another uncaught error which was causing the issue. Thanks for the tip about using onClick
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top