Copy link to clipboard
Copied
Ok so I have a situation where I have Checkboxes and textboxes that are related and need to populate together to a single textbox BUT I have another set of checkboxes and textboxes that are related that ALSO need to populate together to the SAME single textbox 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(", ");
Copy link to clipboard
Copied
It's certainly possible, but you haven't said how you want the output to look exactly. A simple merging of the scripts could be:
Those look like calculate scripts, so all you'd need to so is something like:
var values = [];
for (var i = 280; 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("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);
if (this.getField("WS Time").valueAsString != "") values.push("WS Time: " + this.getField("WS Time").valueAsString);
event.value = values.join(", ");
Copy link to clipboard
Copied
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?