Copy link to clipboard
Copied
I have a variety of check boxes and radio buttons that I need to display text in a separate text box. The check boxes are working up to the point of the radio buttons, but the radio buttons and any check boxes after the radio buttons are not. They also need to be in a specific order, where I have a group of check boxes, followed by radio buttons, followed by check boxes. This is what I currently have as calculated script, the red portion is my problem spot:
event.value = "";
var v1 = this.getField("Check Box1").value;
if(v1 != "Off"){
event.value += "Rec'd ";
}
var v2 = this.getField("Check Box2").value;
if(v2 != "Off"){
event.value += "adoption decree, ";
}
var v3 = this.getField("Check Box3").value;
if(v3 != "Off"){
event.value += "BC, ";
}
var v4 = this.getField("Check Box4").value;
if(v4 != "Off"){
event.value += "COA request, ";
}
var v5 = this.getField("Check Box5").value;
if(v5 != "Off"){
event.value += "COB doc, ";
}
var v6 = this.getField("Check Box6").value;
if(v6 != "Off"){
event.value += "Court Order, ";
}
var v7 = this.getField("Check Box7").value;
if(v7 != "Off"){
event.value += "DC, ";
}
var v8 = this.getField("Check Box8").value;
if(v8 != "Off"){
event.value += "DD, ";
}
var v9 = this.getField("Check Box9").value;
if(v9 != "Off"){
event.value += "DP docs, ";
}
var v10 = this.getField("Check Box10").value;
if(v10 != "Off"){
event.value += "ID, ";
}
var v11 = this.getField("Check Box11").value;
if(v11 != "Off"){
event.value += "Kaiser EF, ";
}
var v12 = this.getField("Check Box12").value;
if(v12 != "Off"){
event.value += "MC, ";
}
var v13 = this.getField("Check Box13").value;
if(v13 != "Off"){
event.value += "med ID card, ";
}
var v14 = this.getField("Check Box14").value;
if(v14 != "Off"){
event.value += "QMCSO, ";
}
var v15 = this.getField("Check Box15").value;
if(v15 != "Off"){
event.value += "parenting plan, ";
}
var v16 = this.getField("Check Box16").value;
if(v16 != "Off"){
event.value += "PDF, ";
}
var v17 = this.getField("Check Box17").value;
if(v17 != "Off"){
event.value += "SSN card, ";
}
var v18 = this.getField("Check Box18").value;
if(v18 != "Off"){
event.value += "INSERT OTHER ITEM HERE, ";
}
var v19 = this.getField("Choice1").value;
if(v19 != "Off"){
event.value += "Updated ";
}
var v20 = this.getField("Check Box20").value;
if(v20 != "Off"){
event.value += "address, ";
}
var v21 = this.getField("Check Box21").value;
if(v21 != "Off"){
event.value += "dep info, ";
}
var v22 = this.getField("Check Box22").value;
if(v22 != "Off"){
event.value += "name, ";
}
Copy link to clipboard
Copied
Figured it out for myself...if anyone else is interested see below:
event.value = "";
var v18 = this.getField("Check Box18").value;
if(v18 != "Off"){
event.value += "INSERT OTHER ITEM HERE, ";
}
var v19 = this.getField("Group1").valueAsString;
if(v19 == "Choice1"){
event.value += "Updated ";
}
var v20 = this.getField("Check Box20").value;
if(v20 != "Off"){
event.value += "address, ";
}
var v21 = this.getField("Check Box21").value;
if(v21 != "Off"){
event.value += "dep info, ";
}
var v22 = this.getField("Check Box22").value;
if(v22 != "Off"){
event.value += "name, ";
}
var v23 = this.getField("Check Box23").value;
if(v23 != "Off"){
event.value += "part data, ";
}
var v24 = this.getField("Check Box24").value;
if(v24 != "Off"){
event.value += "INSERT OTHER ITEM HERE, ";
}
var v25 = this.getField("Group1").valueAsString;
if(v25 == "Choice2"){
event.value += "No updates needed. ";
}
Copy link to clipboard
Copied
Check the Javascript console for errors (ctrl-j)
Copy link to clipboard
Copied
I could absolutely do that, but not helpful as I have no idea how to use it or write code.
Copy link to clipboard
Copied
You can't press ctrl-j?
Copy link to clipboard
Copied
Of course I can, I have no idea how to use the console or how to write code.
Copy link to clipboard
Copied
Does you get any error message when you use the form.?
Copy link to clipboard
Copied
TypeError: this.getField(...) is null
74:AcroForm:Completed Phone Note:Calculate
Copy link to clipboard
Copied
May be that the field "Choice1" doesn't exists.
Copy link to clipboard
Copied
It does exist, it is a radio button.
Copy link to clipboard
Copied
Is "Choice1" the name of the radio button group?
Copy link to clipboard
Copied
The radio button group is "Group1" but I only want text to be generated when "Choice1" is toggled. When they toggle "Choice2", I do not want any text generated.
Copy link to clipboard
Copied
Test the value of the radio button group.
Copy link to clipboard
Copied
I don't know how to do that.
Copy link to clipboard
Copied
Figured it out for myself...if anyone else is interested see below:
event.value = "";
var v18 = this.getField("Check Box18").value;
if(v18 != "Off"){
event.value += "INSERT OTHER ITEM HERE, ";
}
var v19 = this.getField("Group1").valueAsString;
if(v19 == "Choice1"){
event.value += "Updated ";
}
var v20 = this.getField("Check Box20").value;
if(v20 != "Off"){
event.value += "address, ";
}
var v21 = this.getField("Check Box21").value;
if(v21 != "Off"){
event.value += "dep info, ";
}
var v22 = this.getField("Check Box22").value;
if(v22 != "Off"){
event.value += "name, ";
}
var v23 = this.getField("Check Box23").value;
if(v23 != "Off"){
event.value += "part data, ";
}
var v24 = this.getField("Check Box24").value;
if(v24 != "Off"){
event.value += "INSERT OTHER ITEM HERE, ";
}
var v25 = this.getField("Group1").valueAsString;
if(v25 == "Choice2"){
event.value += "No updates needed. ";
}

