Help custom calculation

Community Beginner ,
Dec 26, 2018

Copy link to clipboard

Copied

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(", ");
Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Sure. Change this line, for example:

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

To:

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

96

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Help custom calculation

Community Beginner ,
Dec 26, 2018

Copy link to clipboard

Copied

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(", ");
Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Sure. Change this line, for example:

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

To:

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

97

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 26, 2018 0
Most Valuable Participant ,
Dec 27, 2018

Copy link to clipboard

Copied

Sure. Change this line, for example:

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

To:

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 27, 2018 1