I have 3 radio buttons, How do I enter the script

moufasa44

18-09-2017

I have 3 radio buttons 1=New, 2=Change, 3=Deactivate & 2 text fields SSN & EIN. When New is selected, I want these text fields to become required. However, once one of the text fields is populated with a value, the other field becomes non-required. How do I accomplish this in LiveCycle & where would I enter the script?

[i cut the title back ussnorway]

[Question moved to the LiveCycle Designer forum]

Accepted Solutions (0)

Answers (2)

Answers (2)

MinusZero

20-09-2017

Hi,

As mouslander said when you add radio buttons to a group, they will all work exclusively (only one can be selected)

1302983_pastedImage_0.png

As for your other question.

In the exit code of each textfield you need to test for null. For example, if the field is not null (contains something) then disable the other text field. You should also add code to enable it to if the field is cleared (null)

form1.#subform[0].tfEIN::exit - (JavaScript, client) //EIN textfield exit event

if (this.resolveNode("$").rawValue != null) {
  this.resolveNode("tfSSN").access = "protected"; //if this field contains something, disable SSN text field
}

if (this.resolveNode("$").rawValue == null) {
  this.resolveNode("tfSSN").access = "open"; //if this field doesnt contain something, enable SSN text field
}

form1.#subform[0].tfSSN::exit - (JavaScript, client) //SSN textfield exit event
if (this.resolveNode("$").rawValue != null) {
  this.resolveNode("tfEIN").access = "protected"; //if this field contains something, disable EIN text field
}

if (this.resolveNode("$").rawValue == null) {
  this.resolveNode("tfEIN").access = "open"; //if this field doesnt contain something, enable EIN text field
}

mouslander

19-09-2017

Put the script on the grouping around the radio buttons. The radio buttons should all be part of the same grouping to make them mutually exclusive.