Forum Discussion

Amna's avatar
Amna
Occasional Contributor
4 years ago

How to check the state of the checkbox?

In my test script there is a screen from which I have to check that either the checkbox is being checked or unchecked . If the checkbox state is checked then it should display the message that state ...
  • BenoitB's avatar
    BenoitB
    4 years ago

    Sorry but this is not clear for me.

     

    You want to examine the value of a checkbox

    And if the value is checked (true) then allow user to change the value.

     

    That's what you need ?

     

    To ask user to set a value you can use (quick and dirty code) :

    let checkboxValue = myWebObject.checked;
    if (checkboxValue) {
      let result = MessageDlg("Choose value of the checkbox by hitting the Yes for true or No for False", mtConfirmation, MkSet(mbYes, mbNo), 0);
      myWebObject.checked = result == mrYes;
    }