Skip to main content
lilleem89
Participating Frequently
December 27, 2018
Answered

Help custom calculation

  • December 27, 2018
  • 1 reply
  • 552 views

Ok, I have Javascript below that populates multiple checkbox values and multiple text box values into 1 single text box on a different page BUT the values of the text boxes are numbers and when they populate to the single text box there is no way of telling what the number value pertains to.  so for example: If I type into "Temp" textbox "96"....I want "Temp - 96" to populate to the single textbox. Is this possible with this script? if not, please help!

var values = []; 

for (var i=500; i<=505; 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("Vision Findings").valueAsString!="") values.push(this.getField("Vision Findings").valueAsString);

if (this.getField("Temp").valueAsString!="") values.push(this.getField("Temp").valueAsString);

if (this.getField("BPright").valueAsString!="") values.push(this.getField("BPright").valueAsString);

if (this.getField("BPleft").valueAsString!="") values.push(this.getField("BPleft").valueAsString);

if (this.getField("Oxi").valueAsString!="") values.push(this.getField("Oxi").valueAsString);

if (this.getField("Pulse").valueAsString!="") values.push(this.getField("Pulse").valueAsString);

if (this.getField("Resp").valueAsString!="") values.push(this.getField("Resp").valueAsString);

if (this.getField("Chest Exp").valueAsString!="") values.push(this.getField("Chest Exp").valueAsString);

  1. event.value = values.join(", ");
This topic has been closed for replies.
Correct answer try67

Sure. Change this line, for example:

values.push(this.getField("Temp").valueAsString);

To:

values.push("Temp: " + this.getField("Temp").valueAsString);

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 27, 2018

Sure. Change this line, for example:

values.push(this.getField("Temp").valueAsString);

To:

values.push("Temp: " + this.getField("Temp").valueAsString);