Start cursor in a specific field when pdf is opened

Participant ,
Dec 07, 2017

Copy link to clipboard

Copied

I have a PDF form set up that when someone opens it, the cursor is set in a specific field.  My form has to be signed four times so it's passed around.  I'm trying to set it up where each time a part of the form is completed and passed on to the next person, they open the form and the cursor is set up in their part.  Here's what I have right now set up in Page Properties Action tab but it's not working:

if this.getField("Sig One").value = "";{

getField("Date").setFocus();

} else if (this.getField("Sig One").value != "" && this.getField("Sig Two") = "";{

getField("Sup Name").setFocus();

and so on.  What am I doing wrong?

After removing the ';' it all came together nicely!!! Thanks everyone!

TOPICS
Acrobat SDK and JavaScript, Windows

Views

150

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

Start cursor in a specific field when pdf is opened

Participant ,
Dec 07, 2017

Copy link to clipboard

Copied

I have a PDF form set up that when someone opens it, the cursor is set in a specific field.  My form has to be signed four times so it's passed around.  I'm trying to set it up where each time a part of the form is completed and passed on to the next person, they open the form and the cursor is set up in their part.  Here's what I have right now set up in Page Properties Action tab but it's not working:

if this.getField("Sig One").value = "";{

getField("Date").setFocus();

} else if (this.getField("Sig One").value != "" && this.getField("Sig Two") = "";{

getField("Sup Name").setFocus();

and so on.  What am I doing wrong?

After removing the ';' it all came together nicely!!! Thanks everyone!

TOPICS
Acrobat SDK and JavaScript, Windows

Views

151

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 07, 2017 0
Most Valuable Participant ,
Dec 07, 2017

Copy link to clipboard

Copied

A couple of things.

First of all, you're using the wrong operator. The "=" operator assigns a value. The comparison operator is "==".

In addition, the condition after the if-statement must be placed within parentheses, which you didn't do in either one of your if-statements (lines 1 and 3).

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

Copy link to clipboard

Copied

ok thanks.  I did the full code and it's giving me a syntax error at line 4:

if (this.getField("Sig: One").value == "");{

getField("Date (YYYYMMDD)").setFocus();

} else if (this.getField("Sig: One").value != "" && this.getField("Sig: Two").value == "");{

getField("Sig: Two").setFocus();

} else if (this.getField("Sig: One").value != "" && this.getField("Sig: Two").value != "" && this.getField("Sig: Three").value == "");{

getField("Name: 3").setFocus();

} else if (this.getField("Sig: One").value != "" && this.getField("Sig: Two").value != "" && this.getField("Name: 3").value != "");{

getField("Name: Five").setFocus();

}

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

Copy link to clipboard

Copied

Nevermind,  I didn't see Bernd Alheit's comment before submitting.

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

Copy link to clipboard

Copied

After removing the ';' it all came together nicely!!! Thanks everyone!

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 07, 2017 0
Adobe Community Professional ,
Dec 07, 2017

Copy link to clipboard

Copied

and remove character ';' on line 1 and 3

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