Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Certain text in a field

Participant ,
Dec 15, 2017 Dec 15, 2017

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?

TOPICS
Acrobat SDK and JavaScript , Windows
422
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 15, 2017 Dec 15, 2017

Replace line #3 with:

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

Translate
Community Expert ,
Dec 15, 2017 Dec 15, 2017

Replace line #3 with:

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 15, 2017 Dec 15, 2017
LATEST

Gilad,

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

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