ISO submit button javascript

Dec 05, 2017

Copy link to clipboard

Copied

I'm having trouble validating some required fields in an adobe acrobat pdf.  I need to have the submit button validate text/radio buttons/check buttons to be filled out prior to emailing.  I also have some fields that are entered to generate in the subject line of the email.  But the fields highlighted in orange below are not being validated and can be submitted without a value.  I copy and pasted from some of the other buttons code found in the form but I'm sure there's a kink in the code somewhere.  I need them to be just check boxes and not white. See the code for one of the buttons below.

This is my submit button code.

var f1 = this.getField("Logic");
var f2 = this.getField("Shift");
var f3 = this.getField("Item");
var f4 = this.getField("Unwind");
var f5 = this.getField("Roll QTY");
var f6 = this.getField("Time Procedure Completed");
var f7 = this.getField("Start Time");
var f8 = this.getField("OP I1");
var f9 = this.getField("OP I2 ");
var f10 = this.getField("OP I3");
var f11 = this.getField("OP I4");
var f12 = this.getField("OP I5");
var f13 = this.getField("OP I6");
var f14 = this.getField("OP I7");
var f15 = this.getField("OP I8");
var f16 = this.getField("OP I9");
var f17 = this.getField("OP I10");
var f18 = this.getField("OP I11");
var f19 = this.getField("OP I12");
var f20 = this.getField("OP I13");
var f21 = this.getField("OP I14");
var f22 = this.getField("OP I15");
var f23 = this.getField("OP I16");
var f24 = this.getField("OP I17");
var f25 = this.getField("OP I18");
var f26 = this.getField("OP I19");
var f27 = this.getField("OP I20");
var f28 = this.getField("OP I21");
var f29 = this.getField("OP I22");
var f30 = this.getField("OP I23");
var f31 = this.getField("OP I24");
var f32 = this.getField("OP I25");
var f33 = this.getField("OP I26");
var f34 = this.getField("OP I27");
var f35 = this.getField("OP I28");
var f36 = this.getField("OP I29");
var f37 = this.getField("OP I30");
var f38 = this.getField("OP I31");
var f39 = this.getField("OP I32");
var f40 = this.getField("QTY Produced");

//pre assign all the P/F buttons here to empty strings..one per columns

var CaseTag = "";
var CoreTag = "";
var PrintedTag = "";
var SampleLabel = "";
var LineClearance = "";
var SRI = "";
var TimeProcedure = "";
var Start = "";
var SamplePulled = "";
var WinTrak = "";
var CommentsProblems = "";
var column0_00 = "";
var column0_25 = "";
var column0_50 = "";
var column0_75 = "";
var column1_00 = "";
var column1_25 = "";
var column1_50 = "";
var column1_75 = "";
var column2_00 = "";
var column2_25 = "";
var column2_50 = "";
var column2_75 = "";
var column3_00 = "";
var column3_25 = "";
var column3_50 = "";
var column3_75 = "";
var column4_00 = "";
var column4_25 = "";
var column4_50 = "";
var column4_75 = "";
var column5_00 = "";
var column5_25 = "";
var column5_50 = "";
var column5_75 = "";
var column6_00 = "";
var column6_25 = "";
var column6_50 = "";
var column6_75 = "";
var column7_00 = "";
var column7_25 = "";
var column7_50 = "";
var column7_75 = "";

//don't create variable for Reviewed by, not required button

//checking which radio button to use

if (this.getField("CaseTag_Y").value != 0) {
CaseTag = this.getField("CaseTag_Y");
} else if (this.getField("CaseTag_NAP").value != 0) {
CaseTag = this.getField("CaseTag_NAP");

}
if (this.getField("CoreTag_Y").value != 0) {
CoreTag = this.getField("CoreTag_Y");
} else if (this.getField("CoreTag_NAP").value != 0) {
CoreTag = this.getField("CoreTag_NAP");

}
if (this.getField("PrintedTag_Y").value != 0) {
PrintedTag = this.getField("PrintedTag_Y");
} else if (this.getField("PrintedTag_NAP").value != 0) {
PrintedTag = this.getField("PrintedTag_NAP");

}
if (this.getField("SampleLabel_Y").value != 0) {
SampleLabel = this.getField("SampleLabel_Y");
} else if (this.getField("SampleLabel_NAP").value != 0) {
SampleLabel = this.getField("SampleLabel_NAP");

}
if (this.getField("LineClearance_Y").value != 0) {
LineClearance = this.getField("LineClearance_Y");
} else if (this.getField("LineClearance_NAP").value != 0) {
LineClearance = this.getField("LineClearance_NAP");

}
if (this.getField("TimeProcedure_Y").value != 0) {
TimeProcedure = this.getField("TimeProcedure_Y");
} else if (this.getField("TimeProcedure_NAP").value != 0) {
TimeProcedure = this.getField("TimeProcedure_NAP");

}
if (this.getField("Start_Y").value != 0) {
Start = this.getField("Start_Y");
} else if (this.getField("Start_NAP").value != 0) {
Start = this.getField("Start_NAP");

}
if (this.getField("SamplePulled_Y").value != 0) {
SamplePulled = this.getField("SamplePulled_Y");
} else if (this.getField("SamplePulled_NAP").value != 0) {
SamplePulled = this.getField("SamplePulled_NAP");

}
if (this.getField("WinTrak_Y").value != 0) {
WinTrak = this.getField("WinTrak_Y");
} else if (this.getField("WinTrak_NAP").value != 0) {
WinTrak = this.getField("WinTrak_NAP");

}
if (this.getField("CommentsProblems_Y").value != 0) {
CommentsProblems = this.getField("CommentsProblems_Y");
} else if (this.getField("CommentsProblems_NAP").value != 0) {
CommentsProblems = this.getField("CommentsProblems_NAP");

}
if (this.getField("Coating1_P").value != 0) {
column0_00 = this.getField("Coating1_P");
} else if (this.getField("Coating1_F").value != 0) {
column0_00 = this.getField("Coating1_F");

}
if (this.getField("Coating2_P").value != 0) {
column0_25 = this.getField("Coating2_P");
} else if (this.getField("Coating2_F").value != 0) {
column0_25 = this.getField("Coating2_F");

}
if (this.getField("Coating3_P".value) != 0) {
column0_50 = this.getField("Coating3_P");
} else if (this.getField("Coating3_F").value != 0) {
column0_50 = this.getField("Coating3_F");

}
if (this.getField("Coating4_P").value != 0) {
column0_75 = this.getField("Coating4_P");
} else if (this.getField("Coating4_F").value != 0) {
column0_75 = this.getField("Coating4_F");

}
if (this.getField("Coating5_P").value != 0) {
column1_00 = this.getField("Coating5_P");
} else if (this.getField("Coating5_F").value != 0) {
column1_00 = this.getField("Coating5_F");

}
if (this.getField("Coating6_P").value != 0) {
column1_25 = this.getField("Coating6_P");
} else if (this.getField("Coating6_F").value != 0) {
column1_25 = this.getField("Coating6_F");

}
if (this.getField("Coating7_P").value != 0) {
column1_50 = this.getField("Coating7_P");
} else if (this.getField("Coating7_F").value != 0) {
column1_50 = this.getField("Coating7_F");

}
if (this.getField("Coating8_P").value != 0) {
column1_75 = this.getField("Coating8_P");
} else if (this.getField("Coating8_F").value != 0) {
column1_75 = this.getField("Coating8_F");

}
if (this.getField("Coating9_P").value != 0) {
column2_00 = this.getField("Coating9_P");
} else if (this.getField("Coating9_F").value != 0) {
column2_00 = this.getField("Coating9_F");

}
if (this.getField("Coating10_P").value != 0) {
column2_25 = this.getField("Coating10_P");
} else if (this.getField("Coating10_F").value != 0) {
column2_25 = this.getField("Coating10_F");

}
if (this.getField("Coating11_P").value != 0) {
column2_50 = this.getField("Coating11_P");
} else if (this.getField("Coating11_F").value != 0) {
column2_50 = this.getField("Coating11_F");

}
if (this.getField("Coating12_P").value != 0) {
column2_75 = this.getField("Coating12_P");
} else if (this.getField("Coating12_F").value != 0) {
column2_75 = this.getField("Coating12_F");
;
}
if (this.getField("Coating13_P").value != 0) {
column3_00 = this.getField("Coating13_P");
} else if (this.getField("Coating13_F").value != 0) {
column3_00 = this.getField("Coating13_F");

}
if (this.getField("Coating14_P").value != 0) {
column3_25 = this.getField("Coating14_P");
} else if (this.getField("Coating14_F").value != 0) {
column3_25 = this.getField("Coating14_F");

}
if (this.getField("Coating15_P").value != 0) {
column3_50 = this.getField("Coating15_P");
} else if (this.getField("Coating15_F").value != 0) {
column3_50 = this.getField("Coating15_F");

}
if (this.getField("Coating16_P").value != 0) {
column3_75 = this.getField("Coating16_P");
} else if (this.getField("Coating16_F").value != 0) {
column3_75 = this.getField("Coating16_F");

}
if (this.getField("Coating17_P").value != 0) {
column4_00 = this.getField("Coating17_P");
} else if (this.getField("Coating17_F").value != 0) {
column4_00 = this.getField("Coating17_F");

}
if (this.getField("Coating18_P").value != 0) {
column4_25 = this.getField("Coating18_P");
} else if (this.getField("Coating18_F").value != 0) {
column4_25 = this.getField("Coating18_F");

}
if (this.getField("Coating19_P").value != 0) {
column4_50 = this.getField("Coating19_P");
} else if (this.getField("Coating19_F").value != 0) {
column4_50 = this.getField("Coating19_F");

}
if (this.getField("Coating20_P").value != 0) {
column4_75 = this.getField("Coating20_P");
} else if (this.getField("Coating20_F").value != 0) {
column4_75 = this.getField("Coating20_F");

}
if (this.getField("Coating21_P").value != 0) {
column5_00 = this.getField("Coating21_P");
} else if (this.getField("Coating21_F").value != 0) {
column5_00 = this.getField("Coating21_F");

}
if (this.getField("Coating22_P").value != 0) {
column5_25 = this.getField("Coating22_P");
} else if (this.getField("Coating22_F").value != 0) {
column5_25 = this.getField("Coating22_F");

}
if (this.getField("Coating23_P").value != 0) {
column5_50 = this.getField("Coating23_P");
} else if (this.getField("Coating23_F").value != 0) {
column5_50 = this.getField("Coating23_F");

}
if (this.getField("Coating24_P").value != 0) {
column5_75 = this.getField("Coating24_P");
} else if (this.getField("Coating24_F").value != 0) {
column5_75 = this.getField("Coating24_F");

}
if (this.getField("Coating25_P").value != 0) {
column6_00 = this.getField("Coating25_P");
} else if (this.getField("Coating25_F").value != 0) {
column6_00 = this.getField("Coating25_F");

}
if (this.getField("Coating26_P").value != 0) {
column6_25 = this.getField("Coating26_P");
} else if (this.getField("Coating26_F").value != 0) {
column6_25 = this.getField("Coating26_F");

}
if (this.getField("Coating27_P").value != 0) {
column6_50 = this.getField("Coating27_P");
} else if (this.getField("Coating27_F").value != 0) {
column6_50 = this.getField("Coating27_F");

}
if (this.getField("Coating28_P").value != 0) {
column6_75 = this.getField("Coating28_P");
} else if (this.getField("Coating28_F").value != 0) {
column6_75 = this.getField("Coating28_F");

}
if (this.getField("Coating29_P").value != 0) {
column7_00 = this.getField("Coating29_P");
} else if (this.getField("Coating29_F").value != 0) {
column7_00 = this.getField("Coating29_F");

}
if (this.getField("Coating30_P").value != 0) {
column7_25 = this.getField("Coating30_P");
} else if (this.getField("Coating30_F").value != 0) {
column7_25 = this.getField("Coating30_F");

}
if (this.getField("Coating31_P").value != 0) {
column7_50 = this.getField("Coating31_P");
} else if (this.getField("Coating31_F").value != 0) {
column7_50 = this.getField("Coating31_F");

}
if (this.getField("Coating32_P").value != 0) {
column7_75 = this.getField("Coating32_P");
} else if (this.getField("Coating32_F").value != 0) {
column7_75 = this.getField("Coating32_F");

}

if (this.getField("Coating32_P").value != 0) {
column7_75 = this.getField("Coating32_P");
} else if (this.getField("Coating32_F").value != 0) {
column7_75 = this.getField("Coating32_F");

}
//check if any of the required feels are empty, if they are, send user an alert
//paste all value checks inside parentheses, last statement doesn't need an OR
if (f1.value == "" || f2.value == "" || f3.value == ""|| f4.value == ""|| f5.value == ""|| f6.value == ""|| f7.value == ""|| f8.value == ""|| f9.value == ""|| f10.value == ""|| f11.value == "" || f12.value == "" || f13.value == ""|| f14.value == ""|| f15.value == ""|| f16.value == ""|| f17.value == ""|| f18.value == ""|| f19.value == ""|| f20.value == ""|| f21.value == "" || f22.value == "" || f23.value == ""|| f24.value == ""|| f25.value == ""|| f26.value == ""|| f27.value == ""|| f28.value == ""|| f29.value == ""|| f30.value == "" || f31.value == "" || f32.value == "" || f33.value == ""|| f34.value == ""|| f35.value == ""|| f36.value == ""|| f37.value == ""|| f38.value == ""|| f39.value == ""|| f40.value == ""|| CaseTag == ""|| CoreTag == ""|| PrintedTag == ""|| SampleLabel == ""|| LineClearance == ""|| TimeProcedure == ""|| Start == ""||  SamplePulled == ""|| WinTrak == ""||  CommentsProblems == ""|| column0_00 == ""|| column0_25 == ""|| column0_50 == ""|| column0_75 == ""|| column1_00 == ""|| column1_25 == ""|| column1_50 == ""|| column1_75 == ""|| column2_00 == ""|| column2_25 == ""|| column2_50 == ""|| column2_75 == ""|| column3_00 == ""|| column3_25 == ""|| column3_50 == ""|| column3_75 == ""|| column4_00 == ""|| column4_25 == ""|| column4_50 == ""|| column4_75 == ""|| column5_00 == ""|| column5_25 == ""|| column5_50 == ""|| column5_75 == ""|| column6_00 == ""|| column6_25 == ""|| column6_50 == ""|| column6_75 == ""|| column7_00 == ""|| column7_25 == ""|| column7_50 == ""|| column7_75 == "") {
app.alert ('Please enter all the required fields ');
} else {
var cSubLine = this.getField("Item").value;
this.mailDoc({bUI: true,  cTo: "genericemail@email.com",  cSubject: cSubLine+(" SRI Checklist")}); 
}            

These are Y and NAP Buttons see code below I need these to be just check boxes but with the

Case Tag Button Yes Code

JavaScript 1

// CaseTag_NAP value is set to 1 when selected

// select circle and font color white

// clear all buttons in "CaseTag_Y"

var fields = "CaseTag_Y";

var button = "CaseTag_NAP";

// make the border white for all buttons

this.resetForm(button);

this.getField("CaseTag_NAP").strokeColor = color.black;

// make the target button's border black

this.event.target.strokeColor = color.black;

// update export form field

this.getField("CaseTag_Y").value = 1;

JavaScript 2

// If radio CaseTag_Y is selected, make CaseTag_NAP unselected, and vise versa
var CaseTag_Y = this.getField("CaseTag_Y");
var CaseTag_NAP = this.getField("CaseTag_NAP");

//if other button is selected, set value to 0 and color to white
if (CaseTag_Y = 1){
    CaseTag_NAP.value = 0;
    CaseTag_NAP.strokeColor = color.black;
}
if(CaseTag_NAP = 1) {
    CaseTag_Y.value = 0;
    CaseTag_Y.strokeColor = color.black;
}

Case Button NAP Code

JavaScript 1

// CaseTag_NAP value is set to 1 when selected

// select circle and font color white

// clear all buttons in "CaseTag_" array

var fields = "CaseTag_Y";

var button = "CaseTag_Y";

this.resetForm(button);

// make the border white for all buttons in array

this.getField("CaseTag_Y").strokeColor = color.black;

// make the target button's border black

this.event.target.strokeColor = color.black;

// update export form field

this.getField("CaseTag_NAP").value = 1;

JavaScript 2

// If CaseTag_Y is selected, make CaseTag_NAP unselected, and vise versa

var CaseTag_Y = this.getField("CaseTag_Y");

var CaseTag_NAP = this.getField("CaseTag_NAP");

if (CaseTag_Y = 1){

    CaseTag_NAP.value = 0;

    CaseTag_NAP.strokeColor = color.black;

}

if(CaseTag_NAP = 1) {

    CaseTag_Y.value = 0;

    CaseTag_Y.strokeColor = color.black;

}

TOPICS
Acrobat SDK and JavaScript

Views

98

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

ISO submit button javascript

Dec 05, 2017

Copy link to clipboard

Copied

I'm having trouble validating some required fields in an adobe acrobat pdf.  I need to have the submit button validate text/radio buttons/check buttons to be filled out prior to emailing.  I also have some fields that are entered to generate in the subject line of the email.  But the fields highlighted in orange below are not being validated and can be submitted without a value.  I copy and pasted from some of the other buttons code found in the form but I'm sure there's a kink in the code somewhere.  I need them to be just check boxes and not white. See the code for one of the buttons below.

This is my submit button code.

var f1 = this.getField("Logic");
var f2 = this.getField("Shift");
var f3 = this.getField("Item");
var f4 = this.getField("Unwind");
var f5 = this.getField("Roll QTY");
var f6 = this.getField("Time Procedure Completed");
var f7 = this.getField("Start Time");
var f8 = this.getField("OP I1");
var f9 = this.getField("OP I2 ");
var f10 = this.getField("OP I3");
var f11 = this.getField("OP I4");
var f12 = this.getField("OP I5");
var f13 = this.getField("OP I6");
var f14 = this.getField("OP I7");
var f15 = this.getField("OP I8");
var f16 = this.getField("OP I9");
var f17 = this.getField("OP I10");
var f18 = this.getField("OP I11");
var f19 = this.getField("OP I12");
var f20 = this.getField("OP I13");
var f21 = this.getField("OP I14");
var f22 = this.getField("OP I15");
var f23 = this.getField("OP I16");
var f24 = this.getField("OP I17");
var f25 = this.getField("OP I18");
var f26 = this.getField("OP I19");
var f27 = this.getField("OP I20");
var f28 = this.getField("OP I21");
var f29 = this.getField("OP I22");
var f30 = this.getField("OP I23");
var f31 = this.getField("OP I24");
var f32 = this.getField("OP I25");
var f33 = this.getField("OP I26");
var f34 = this.getField("OP I27");
var f35 = this.getField("OP I28");
var f36 = this.getField("OP I29");
var f37 = this.getField("OP I30");
var f38 = this.getField("OP I31");
var f39 = this.getField("OP I32");
var f40 = this.getField("QTY Produced");

//pre assign all the P/F buttons here to empty strings..one per columns

var CaseTag = "";
var CoreTag = "";
var PrintedTag = "";
var SampleLabel = "";
var LineClearance = "";
var SRI = "";
var TimeProcedure = "";
var Start = "";
var SamplePulled = "";
var WinTrak = "";
var CommentsProblems = "";
var column0_00 = "";
var column0_25 = "";
var column0_50 = "";
var column0_75 = "";
var column1_00 = "";
var column1_25 = "";
var column1_50 = "";
var column1_75 = "";
var column2_00 = "";
var column2_25 = "";
var column2_50 = "";
var column2_75 = "";
var column3_00 = "";
var column3_25 = "";
var column3_50 = "";
var column3_75 = "";
var column4_00 = "";
var column4_25 = "";
var column4_50 = "";
var column4_75 = "";
var column5_00 = "";
var column5_25 = "";
var column5_50 = "";
var column5_75 = "";
var column6_00 = "";
var column6_25 = "";
var column6_50 = "";
var column6_75 = "";
var column7_00 = "";
var column7_25 = "";
var column7_50 = "";
var column7_75 = "";

//don't create variable for Reviewed by, not required button

//checking which radio button to use

if (this.getField("CaseTag_Y").value != 0) {
CaseTag = this.getField("CaseTag_Y");
} else if (this.getField("CaseTag_NAP").value != 0) {
CaseTag = this.getField("CaseTag_NAP");

}
if (this.getField("CoreTag_Y").value != 0) {
CoreTag = this.getField("CoreTag_Y");
} else if (this.getField("CoreTag_NAP").value != 0) {
CoreTag = this.getField("CoreTag_NAP");

}
if (this.getField("PrintedTag_Y").value != 0) {
PrintedTag = this.getField("PrintedTag_Y");
} else if (this.getField("PrintedTag_NAP").value != 0) {
PrintedTag = this.getField("PrintedTag_NAP");

}
if (this.getField("SampleLabel_Y").value != 0) {
SampleLabel = this.getField("SampleLabel_Y");
} else if (this.getField("SampleLabel_NAP").value != 0) {
SampleLabel = this.getField("SampleLabel_NAP");

}
if (this.getField("LineClearance_Y").value != 0) {
LineClearance = this.getField("LineClearance_Y");
} else if (this.getField("LineClearance_NAP").value != 0) {
LineClearance = this.getField("LineClearance_NAP");

}
if (this.getField("TimeProcedure_Y").value != 0) {
TimeProcedure = this.getField("TimeProcedure_Y");
} else if (this.getField("TimeProcedure_NAP").value != 0) {
TimeProcedure = this.getField("TimeProcedure_NAP");

}
if (this.getField("Start_Y").value != 0) {
Start = this.getField("Start_Y");
} else if (this.getField("Start_NAP").value != 0) {
Start = this.getField("Start_NAP");

}
if (this.getField("SamplePulled_Y").value != 0) {
SamplePulled = this.getField("SamplePulled_Y");
} else if (this.getField("SamplePulled_NAP").value != 0) {
SamplePulled = this.getField("SamplePulled_NAP");

}
if (this.getField("WinTrak_Y").value != 0) {
WinTrak = this.getField("WinTrak_Y");
} else if (this.getField("WinTrak_NAP").value != 0) {
WinTrak = this.getField("WinTrak_NAP");

}
if (this.getField("CommentsProblems_Y").value != 0) {
CommentsProblems = this.getField("CommentsProblems_Y");
} else if (this.getField("CommentsProblems_NAP").value != 0) {
CommentsProblems = this.getField("CommentsProblems_NAP");

}
if (this.getField("Coating1_P").value != 0) {
column0_00 = this.getField("Coating1_P");
} else if (this.getField("Coating1_F").value != 0) {
column0_00 = this.getField("Coating1_F");

}
if (this.getField("Coating2_P").value != 0) {
column0_25 = this.getField("Coating2_P");
} else if (this.getField("Coating2_F").value != 0) {
column0_25 = this.getField("Coating2_F");

}
if (this.getField("Coating3_P".value) != 0) {
column0_50 = this.getField("Coating3_P");
} else if (this.getField("Coating3_F").value != 0) {
column0_50 = this.getField("Coating3_F");

}
if (this.getField("Coating4_P").value != 0) {
column0_75 = this.getField("Coating4_P");
} else if (this.getField("Coating4_F").value != 0) {
column0_75 = this.getField("Coating4_F");

}
if (this.getField("Coating5_P").value != 0) {
column1_00 = this.getField("Coating5_P");
} else if (this.getField("Coating5_F").value != 0) {
column1_00 = this.getField("Coating5_F");

}
if (this.getField("Coating6_P").value != 0) {
column1_25 = this.getField("Coating6_P");
} else if (this.getField("Coating6_F").value != 0) {
column1_25 = this.getField("Coating6_F");

}
if (this.getField("Coating7_P").value != 0) {
column1_50 = this.getField("Coating7_P");
} else if (this.getField("Coating7_F").value != 0) {
column1_50 = this.getField("Coating7_F");

}
if (this.getField("Coating8_P").value != 0) {
column1_75 = this.getField("Coating8_P");
} else if (this.getField("Coating8_F").value != 0) {
column1_75 = this.getField("Coating8_F");

}
if (this.getField("Coating9_P").value != 0) {
column2_00 = this.getField("Coating9_P");
} else if (this.getField("Coating9_F").value != 0) {
column2_00 = this.getField("Coating9_F");

}
if (this.getField("Coating10_P").value != 0) {
column2_25 = this.getField("Coating10_P");
} else if (this.getField("Coating10_F").value != 0) {
column2_25 = this.getField("Coating10_F");

}
if (this.getField("Coating11_P").value != 0) {
column2_50 = this.getField("Coating11_P");
} else if (this.getField("Coating11_F").value != 0) {
column2_50 = this.getField("Coating11_F");

}
if (this.getField("Coating12_P").value != 0) {
column2_75 = this.getField("Coating12_P");
} else if (this.getField("Coating12_F").value != 0) {
column2_75 = this.getField("Coating12_F");
;
}
if (this.getField("Coating13_P").value != 0) {
column3_00 = this.getField("Coating13_P");
} else if (this.getField("Coating13_F").value != 0) {
column3_00 = this.getField("Coating13_F");

}
if (this.getField("Coating14_P").value != 0) {
column3_25 = this.getField("Coating14_P");
} else if (this.getField("Coating14_F").value != 0) {
column3_25 = this.getField("Coating14_F");

}
if (this.getField("Coating15_P").value != 0) {
column3_50 = this.getField("Coating15_P");
} else if (this.getField("Coating15_F").value != 0) {
column3_50 = this.getField("Coating15_F");

}
if (this.getField("Coating16_P").value != 0) {
column3_75 = this.getField("Coating16_P");
} else if (this.getField("Coating16_F").value != 0) {
column3_75 = this.getField("Coating16_F");

}
if (this.getField("Coating17_P").value != 0) {
column4_00 = this.getField("Coating17_P");
} else if (this.getField("Coating17_F").value != 0) {
column4_00 = this.getField("Coating17_F");

}
if (this.getField("Coating18_P").value != 0) {
column4_25 = this.getField("Coating18_P");
} else if (this.getField("Coating18_F").value != 0) {
column4_25 = this.getField("Coating18_F");

}
if (this.getField("Coating19_P").value != 0) {
column4_50 = this.getField("Coating19_P");
} else if (this.getField("Coating19_F").value != 0) {
column4_50 = this.getField("Coating19_F");

}
if (this.getField("Coating20_P").value != 0) {
column4_75 = this.getField("Coating20_P");
} else if (this.getField("Coating20_F").value != 0) {
column4_75 = this.getField("Coating20_F");

}
if (this.getField("Coating21_P").value != 0) {
column5_00 = this.getField("Coating21_P");
} else if (this.getField("Coating21_F").value != 0) {
column5_00 = this.getField("Coating21_F");

}
if (this.getField("Coating22_P").value != 0) {
column5_25 = this.getField("Coating22_P");
} else if (this.getField("Coating22_F").value != 0) {
column5_25 = this.getField("Coating22_F");

}
if (this.getField("Coating23_P").value != 0) {
column5_50 = this.getField("Coating23_P");
} else if (this.getField("Coating23_F").value != 0) {
column5_50 = this.getField("Coating23_F");

}
if (this.getField("Coating24_P").value != 0) {
column5_75 = this.getField("Coating24_P");
} else if (this.getField("Coating24_F").value != 0) {
column5_75 = this.getField("Coating24_F");

}
if (this.getField("Coating25_P").value != 0) {
column6_00 = this.getField("Coating25_P");
} else if (this.getField("Coating25_F").value != 0) {
column6_00 = this.getField("Coating25_F");

}
if (this.getField("Coating26_P").value != 0) {
column6_25 = this.getField("Coating26_P");
} else if (this.getField("Coating26_F").value != 0) {
column6_25 = this.getField("Coating26_F");

}
if (this.getField("Coating27_P").value != 0) {
column6_50 = this.getField("Coating27_P");
} else if (this.getField("Coating27_F").value != 0) {
column6_50 = this.getField("Coating27_F");

}
if (this.getField("Coating28_P").value != 0) {
column6_75 = this.getField("Coating28_P");
} else if (this.getField("Coating28_F").value != 0) {
column6_75 = this.getField("Coating28_F");

}
if (this.getField("Coating29_P").value != 0) {
column7_00 = this.getField("Coating29_P");
} else if (this.getField("Coating29_F").value != 0) {
column7_00 = this.getField("Coating29_F");

}
if (this.getField("Coating30_P").value != 0) {
column7_25 = this.getField("Coating30_P");
} else if (this.getField("Coating30_F").value != 0) {
column7_25 = this.getField("Coating30_F");

}
if (this.getField("Coating31_P").value != 0) {
column7_50 = this.getField("Coating31_P");
} else if (this.getField("Coating31_F").value != 0) {
column7_50 = this.getField("Coating31_F");

}
if (this.getField("Coating32_P").value != 0) {
column7_75 = this.getField("Coating32_P");
} else if (this.getField("Coating32_F").value != 0) {
column7_75 = this.getField("Coating32_F");

}

if (this.getField("Coating32_P").value != 0) {
column7_75 = this.getField("Coating32_P");
} else if (this.getField("Coating32_F").value != 0) {
column7_75 = this.getField("Coating32_F");

}
//check if any of the required feels are empty, if they are, send user an alert
//paste all value checks inside parentheses, last statement doesn't need an OR
if (f1.value == "" || f2.value == "" || f3.value == ""|| f4.value == ""|| f5.value == ""|| f6.value == ""|| f7.value == ""|| f8.value == ""|| f9.value == ""|| f10.value == ""|| f11.value == "" || f12.value == "" || f13.value == ""|| f14.value == ""|| f15.value == ""|| f16.value == ""|| f17.value == ""|| f18.value == ""|| f19.value == ""|| f20.value == ""|| f21.value == "" || f22.value == "" || f23.value == ""|| f24.value == ""|| f25.value == ""|| f26.value == ""|| f27.value == ""|| f28.value == ""|| f29.value == ""|| f30.value == "" || f31.value == "" || f32.value == "" || f33.value == ""|| f34.value == ""|| f35.value == ""|| f36.value == ""|| f37.value == ""|| f38.value == ""|| f39.value == ""|| f40.value == ""|| CaseTag == ""|| CoreTag == ""|| PrintedTag == ""|| SampleLabel == ""|| LineClearance == ""|| TimeProcedure == ""|| Start == ""||  SamplePulled == ""|| WinTrak == ""||  CommentsProblems == ""|| column0_00 == ""|| column0_25 == ""|| column0_50 == ""|| column0_75 == ""|| column1_00 == ""|| column1_25 == ""|| column1_50 == ""|| column1_75 == ""|| column2_00 == ""|| column2_25 == ""|| column2_50 == ""|| column2_75 == ""|| column3_00 == ""|| column3_25 == ""|| column3_50 == ""|| column3_75 == ""|| column4_00 == ""|| column4_25 == ""|| column4_50 == ""|| column4_75 == ""|| column5_00 == ""|| column5_25 == ""|| column5_50 == ""|| column5_75 == ""|| column6_00 == ""|| column6_25 == ""|| column6_50 == ""|| column6_75 == ""|| column7_00 == ""|| column7_25 == ""|| column7_50 == ""|| column7_75 == "") {
app.alert ('Please enter all the required fields ');
} else {
var cSubLine = this.getField("Item").value;
this.mailDoc({bUI: true,  cTo: "genericemail@email.com",  cSubject: cSubLine+(" SRI Checklist")}); 
}            

These are Y and NAP Buttons see code below I need these to be just check boxes but with the

Case Tag Button Yes Code

JavaScript 1

// CaseTag_NAP value is set to 1 when selected

// select circle and font color white

// clear all buttons in "CaseTag_Y"

var fields = "CaseTag_Y";

var button = "CaseTag_NAP";

// make the border white for all buttons

this.resetForm(button);

this.getField("CaseTag_NAP").strokeColor = color.black;

// make the target button's border black

this.event.target.strokeColor = color.black;

// update export form field

this.getField("CaseTag_Y").value = 1;

JavaScript 2

// If radio CaseTag_Y is selected, make CaseTag_NAP unselected, and vise versa
var CaseTag_Y = this.getField("CaseTag_Y");
var CaseTag_NAP = this.getField("CaseTag_NAP");

//if other button is selected, set value to 0 and color to white
if (CaseTag_Y = 1){
    CaseTag_NAP.value = 0;
    CaseTag_NAP.strokeColor = color.black;
}
if(CaseTag_NAP = 1) {
    CaseTag_Y.value = 0;
    CaseTag_Y.strokeColor = color.black;
}

Case Button NAP Code

JavaScript 1

// CaseTag_NAP value is set to 1 when selected

// select circle and font color white

// clear all buttons in "CaseTag_" array

var fields = "CaseTag_Y";

var button = "CaseTag_Y";

this.resetForm(button);

// make the border white for all buttons in array

this.getField("CaseTag_Y").strokeColor = color.black;

// make the target button's border black

this.event.target.strokeColor = color.black;

// update export form field

this.getField("CaseTag_NAP").value = 1;

JavaScript 2

// If CaseTag_Y is selected, make CaseTag_NAP unselected, and vise versa

var CaseTag_Y = this.getField("CaseTag_Y");

var CaseTag_NAP = this.getField("CaseTag_NAP");

if (CaseTag_Y = 1){

    CaseTag_NAP.value = 0;

    CaseTag_NAP.strokeColor = color.black;

}

if(CaseTag_NAP = 1) {

    CaseTag_Y.value = 0;

    CaseTag_Y.strokeColor = color.black;

}

TOPICS
Acrobat SDK and JavaScript

Views

99

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 05, 2017 0
Dec 05, 2017

Copy link to clipboard

Copied

Suggest you use an app.alert to report on the value of the problem fields and see what is coming to your script.

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 05, 2017 1
Dec 05, 2017

Copy link to clipboard

Copied

You can't expect us to go over your entire script... You need to narrow it down to a specific issue.

However, from a quick glance I noticed you're making a classic error of assigning values instead of comparing them.

For example, in this line:

if (CaseTag_Y = 1){

It should be:

if (CaseTag_Y == 1){

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 05, 2017 1
Dec 05, 2017

Copy link to clipboard

Copied

When radio button or check box fields or groups of radio buttons or check boxes are not selected or checked, their value is the string value "Off". Other fields have a default value and one can test a field to see if the devaultValue of a field is the same as the value of the field and if so then the field has not been completed.

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 05, 2017 1