0

I have a form that has several groups named "transType", within these groups are a text field and a group of 3 radio buttons. Each radio button group has the values of Yes, No and Resolved. I have one radio button group at the top that, when clicked, the corresponding buttons on the page are also selected, e.g. I click "No" on the top group, and all the "No" fields below are selected. I am using the action builder to make this happen, but it seems tedious and I will have to do it for each value. Below is the script as it stands now:


form1.#subform[0].transType[0].markAll::change - (JavaScript, client)
 if (this.rawValue == "1") {
   this.resolveNode("transType[1].exeError").rawValue = "No";
   this.resolveNode("transType[2].newEnrol").rawValue = "No";
   this.resolveNode("transType[3].enrolReq").rawValue = "No";
   this.resolveNode("transType[4].immPinChange").rawValue = "No";
   this.resolveNode("transType[5].pinChange").rawValue = "No";
   this.resolveNode("transType[6].loanProc").rawValue = "No";
   this.resolveNode("transType[7].contribChange").rawValue = "No";
   this.resolveNode("transType[8].allocChange").rawValue = "No";
   this.resolveNode("transType[9].allocChange403b").rawValue = "No";
   this.resolveNode("transType[10].transfTrans").rawValue = "No";
   this.resolveNode("transType[11].confEndBal").rawValue = "No";
   this.resolveNode("transType[12].confTarAlloc").rawValue = "No";
   this.resolveNode("transType[13].loanReq").rawValue = "No";
   this.resolveNode("transType[14].withdrawReq").rawValue = "No";
 }

I posted in the Adobe forum for LiveCycle, but the Adobe forums are basically useless. Is there a easier script I could write? Maybe an array? I'm a bit of a n00b in JavaScript, but I can limp my way around. TIA!!!

Mr.Syrax
  • 396
  • 1
  • 9
  • 26

2 Answers2

0

If you are using data binding, you could bind all the yes/no/not resolved to the same interface field so they would all have the same value. This would mean if you selected a value at the top the rest would inherit the same value.

Having used Livecycle for the past couple of years, there are quicker ways to do it such as adding a function that sets each of the fields to a value but Livecycle can be a bit flakey at times so it is usually best to do it as above. You might use a case statement instead of an if/elseif then it's just a case of copying the same text and changing the values. If you want to send a copy of the form I'll stick in the various options e.g function or case and you can see how it looks/works.

0

From a pure javascript standpoint, you could lighten your code with :

var fields = ["transType[1].exeError", 
                "transType[2].newEnrol",
                "transType[3].enrolReq",
                ...
                "transType[14].withdrawReq"];
var i, j, newValue;

switch(this.rawValue) {
    case "1" : newValue = "No"; break;
    ...
}

for(i=0, j=fields.length; i<j; i++) {
    this.resolveNode(fields[i]).rawValue = newValue;
}
gillup
  • 38
  • 6