Certain text in a field

Dec 15, 2017

Copy link to clipboard

Copied

I have tried so many different ways, that I finally decided to break down and ask the "experts"!  I have a text field where users will input what organization they are with.  I have a popup window "On Focus" that tells the user if they are working for our organization, to input our company name "XYZ"; Otherwise, input whatever.  Later on in the form, there's a submit button to email the PDF form.  If that text field has XYZ G6, it'll send an email to a certain group of people; Otherwise, if that text field doesn't have that key word (XYZ), it sends the email to a different group of people.  Here's what I've been working with:

var sendTo = "john.doe@mail.com";

var sendOther = "bill.jones@mail.com";

var keyWord = this.getField("20 Supervisors Organization").startsWith("XYZ);

if (this.getField("31 Sec Mgr Sig").value != "" && keyWord == true) {

   this.mailDoc({bUI:true, cTo:sendTo...

} else if (this.getField("31 Sec Mgr Sig").value != "" && keyWord == false) {

   this.mailDoc({bUI:true, cTo: SendOther...

I've tried includes(), valueOf(), and other String Methods, but none of them are working.  Am I even going the right route?

Replace line #3 with:

var keyWord = this.getField("20 Supervisors Organization").valueAsString.indexOf("XYZ")==0;

TOPICS
Acrobat SDK and JavaScript, Windows

Views

82

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

Certain text in a field

Dec 15, 2017

Copy link to clipboard

Copied

I have tried so many different ways, that I finally decided to break down and ask the "experts"!  I have a text field where users will input what organization they are with.  I have a popup window "On Focus" that tells the user if they are working for our organization, to input our company name "XYZ"; Otherwise, input whatever.  Later on in the form, there's a submit button to email the PDF form.  If that text field has XYZ G6, it'll send an email to a certain group of people; Otherwise, if that text field doesn't have that key word (XYZ), it sends the email to a different group of people.  Here's what I've been working with:

var sendTo = "john.doe@mail.com";

var sendOther = "bill.jones@mail.com";

var keyWord = this.getField("20 Supervisors Organization").startsWith("XYZ);

if (this.getField("31 Sec Mgr Sig").value != "" && keyWord == true) {

   this.mailDoc({bUI:true, cTo:sendTo...

} else if (this.getField("31 Sec Mgr Sig").value != "" && keyWord == false) {

   this.mailDoc({bUI:true, cTo: SendOther...

I've tried includes(), valueOf(), and other String Methods, but none of them are working.  Am I even going the right route?

Replace line #3 with:

var keyWord = this.getField("20 Supervisors Organization").valueAsString.indexOf("XYZ")==0;

TOPICS
Acrobat SDK and JavaScript, Windows

Views

83

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

Copy link to clipboard

Copied

Replace line #3 with:

var keyWord = this.getField("20 Supervisors Organization").valueAsString.indexOf("XYZ")==0;

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

Copy link to clipboard

Copied

Gilad,

I can't wait to have just 1/8th the knowledge you have with javascript!  Thanks!!  Have a great weekend and Merry Christmas!

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 15, 2017 0