Skip to main content
Inspiring
September 7, 2023
Answered

Checkbox/radio button to display text

  • September 7, 2023
  • 3 replies
  • 2328 views

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, ";

}

This topic has been closed for replies.
Correct answer Leah31805381ekx5

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. ";

}

3 replies

Leah31805381ekx5AuthorCorrect answer
Inspiring
September 8, 2023

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. ";

}

Bernd Alheit
Community Expert
September 7, 2023

May be that the field "Choice1" doesn't exists. 

Known Participant
September 7, 2023

It does exist, it is a radio button.

Bernd Alheit
Community Expert
September 7, 2023

Is  "Choice1" the name of the radio button group? 

Bernd Alheit
Community Expert
September 7, 2023

Check the Javascript console for errors (ctrl-j) 

Inspiring
September 7, 2023

I could absolutely do that, but not helpful as I have no idea how to use it or write code.

Bernd Alheit
Community Expert
September 7, 2023

Of course I can, I have no idea how to use the console or how to write code.

 


Does you get any error message when you use the form.?