Skip to main content
lilleem89
Participating Frequently
January 4, 2019
Question

Complicated Text box population

  • January 4, 2019
  • 1 reply
  • 438 views

Ok so I have a situation where I have Check boxes and text boxes that are related and need to populate together to a single text box  BUT I have another set of check boxes and text boxes that are related that ALSO need to populate together to the SAME single text box mentioned previously. So here are the separate java scripts for each set of data that I want to put into the same single text box. How do I join the scripts together? or is it possible?

Script 1:

var values = [];

for (var i=280; i<=281; i++) {

    var fname = "CheckBox "+i;

    var f = this.getField(fname);

    if (f==null) {

        console.println("Error! Can't find: " + fname);

        continue;

    }

    if (f.valueAsString!="Off") values.push(f.valueAsString);

}

if (this.getField("SLS EO").valueAsString!="") values.push("SLS EO: " + this.getField("SLS EO").valueAsString);

if (this.getField("SLS EC").valueAsString!="") values.push("SLS EC: " + this.getField("SLS EC").valueAsString);

event.value = values.join(", ");

Script 2:

var values = [];

for (var i=282; i<=283; i++) {

    var fname = "CheckBox "+i;

    var f = this.getField(fname);

    if (f==null) {

        console.println("Error! Can't find: " + fname);

        continue;

    }

    if (f.valueAsString!="Off") values.push(f.valueAsString);

}

if (this.getField("WS Time").valueAsString!="") values.push("WS Time: " + this.getField("WS Time").valueAsString);

event.value = values.join(", ");

ok so I need the info from check box 280 and 281 and text boxes "SLS EO" and "SLS EC" to be populate to the text box "Text 4" and the information to stay together/sequentially next to each other as they are related and then Check box 282 and 283 and text box "WS Time" to populate together/sequentially in the "Text 4".

so in the text box "Text 4" the info would be in this order

checkbox 280, checkbox 281, SLS EO, SLS EC, Checkbox 282, Checkbox 282, WS Time.

Does this make sense? Can anyone help me?

This topic has been closed for replies.

1 reply

Bernd Alheit
Community Expert
Community Expert
January 4, 2019

Remove last line from script 1 and remove first line of script 2.