Expand my Community achievements bar.

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

Avatar

Former Community Member

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]

2 Replies

Avatar

Level 7

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.

Avatar

Level 7

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
}