Forum Discussion

underqualified's avatar
underqualified
Occasional Contributor
5 years ago
Solved

UserForms - Checkbox always returning true.

Hey there, I'll preface this by saying I'm a total newb when it comes to coding and basically am learning as I go along.

I've been trying to set up two forms, one basic form where one can only enter base parameters, and one advanced form for more detailed parameters, and said advanced form is supposed to be accessible via a checkbox - if you check the box, the advanced form opens, and if you uncheck it, an additional flag will trigger for the script to disregard the data in the advanced form.

function DataForm_tpAdvanced_OnChange(Sender)
{
  if(UserForms.DataForm.tpAdvanced.Checked)
    UserForms.AdvancedForm.Show();
}

Either way, here's the problem: No matter if the box is checked or unchecked, the Advanced Form will always show. I've changed the script to display in the log whether the box returns true or false, and it returned true and false respectively as expected. However, the if-statement simply ignores it and always returns checked, regardless of the actual state of the box.

 

Thanks in advance

  • Everyone who gave me your helpful responses, I solved it by realizing I was very stupid and looking at JScript and not JavaScript - I adjusted the code to be

    function DataForm_tpAdvanced_OnChange(Sender)
    {
      if(UserForms.DataForm.tpAdvanced.Checked == True)
        UserForms.AdvancedForm.Show();
    }

    and it works like a charm now! Thanks for all the advice and sorry for possibly wasting anyone's time!

8 Replies