How to return a variable value when a check box is clicked in LiveCycle with Java Script

1.5k Views Asked by At

Completely new to Java Script & LiveCycle and I've searched Google for days, so I'm trying to find the answer here. It seems to me it should be simple, but I'm not a programmer.

What would the Java Script code look like in LiveCycle to make a check box return a variable that contains a set of values?

For example, if I select a YES check box to a situation (called "Sit_1_YES"), a new instance will be created of a subform (called "subReqIA") and a set of values from a variable (called "Cat_COP_Sit_1") will automatically appear.

Thank you so much for your help!!

1

There are 1 best solutions below

0
On

I'm not sure exactly where you plan for the values to go in a subform. Normally there would need to be a text field or something similar in that subform (I'm going to presume that there is). You can add something like this to the exit event for the checkbox.

if (this.rawValue == "1"){
    var rowNum = subReq.instanceManager.count;
    subReqIA.instanceManager.addInstance();
    subReqIA[rowNum].tfExample.rawValue = Cat_COP_Sit_1;
    //whatever else you would do
}
else {
    subReqIA.instanceManager.removeInstance();
    //whatever other cleanup you need to do
}