Expand my Community achievements bar.

SOLVED

Prompt User to click checkbox (radio button)

Avatar

Former Community Member

I am trying to ensure that a mandatory check box (which is actually a radio button) is checked before entering data in a form. I have made the checkbox mandatory ( red box around it) but I want a message to display if a person tries to enter data in the first text box in the form if the above checkbox is not clicked. (LS Des 8.21) I am assuming that there should be javascript on the text box upon entry into it?? Just not that up on java. Any help is appreciated

1 Accepted Solution

Avatar

Correct answer by
Level 10

Here's a bit of JavaScript that should do what you need.

(on the Enter event of the text field)

if (RadioButtonList.rawValue == "") {

     xfa.host.messageBox("You need to click the button!");

     this.rawValue == null;

}

Another way to do it would be to hide the other fields on the form until the button is clicked. If you wrapped all the fields that rely on this button in a subform it would quite easy:

(on the Change event of the radio button group)

if (this.rawValue == "1") {

     hiddenSubForm.presence = "visible";

}

else {

     hiddenSubForm.presence = "hidden";

}

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Here's a bit of JavaScript that should do what you need.

(on the Enter event of the text field)

if (RadioButtonList.rawValue == "") {

     xfa.host.messageBox("You need to click the button!");

     this.rawValue == null;

}

Another way to do it would be to hide the other fields on the form until the button is clicked. If you wrapped all the fields that rely on this button in a subform it would quite easy:

(on the Change event of the radio button group)

if (this.rawValue == "1") {

     hiddenSubForm.presence = "visible";

}

else {

     hiddenSubForm.presence = "hidden";

}

Avatar

Former Community Member

Thank you very much, I will give this a try. The second part of wrapping in a subform is just what the Dr. ordered!