Highlighted

Help with Code Syntax error

Community Beginner ,
Sep 24, 2020

Copy link to clipboard

Copied

Can someone PLEASE, tell me where the error is in my code;

Here is the error:

SyntaxError: missing ] after element list
1: at line 2

 

Here is the code:

var fieldsToLock =["Name", "Student#:","Email:", "Phone#:", "Reference#:", Authorized by:", "Approved Amount","Approved Items:", "Price"]
[for (var i in fieldsToLock) this.getField(fieldsToLock[i]).readonly = true;]

 

I can't figure it out!

 

Thank you!

 

TOPICS
PDF forms

Views

73

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 with Code Syntax error

Community Beginner ,
Sep 24, 2020

Copy link to clipboard

Copied

Can someone PLEASE, tell me where the error is in my code;

Here is the error:

SyntaxError: missing ] after element list
1: at line 2

 

Here is the code:

var fieldsToLock =["Name", "Student#:","Email:", "Phone#:", "Reference#:", Authorized by:", "Approved Amount","Approved Items:", "Price"]
[for (var i in fieldsToLock) this.getField(fieldsToLock[i]).readonly = true;]

 

I can't figure it out!

 

Thank you!

 

TOPICS
PDF forms

Views

74

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
Sep 24, 2020 0
Adobe Community Professional ,
Sep 24, 2020

Copy link to clipboard

Copied

Hi,

 

This line does not need to be in [] .

[for (var i in fieldsToLock) this.getField(fieldsToLock[i]).readonly = true;]

I would do it like this

 

for (var i =0; i < fieldsToLock.length; i++) {

this.getField(fieldsToLock[i]).readonly = true;

}

This covers agianst older versions of Adobe Acrobat and Reader being used.

 

Regards

 

Malcolm

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...
Sep 24, 2020 1
Community Beginner ,
Sep 24, 2020

Copy link to clipboard

Copied

Wonderful....I was reaching beyond my skills...you saved my day. Thanks for your time.

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...
Sep 24, 2020 0
Most Valuable Participant ,
Sep 24, 2020

Copy link to clipboard

Copied

You can also see a missing quote - one of the items in the list does not start with "

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...
Sep 24, 2020 1
Lisa5E6F LATEST
Community Beginner ,
Sep 24, 2020

Copy link to clipboard

Copied

Thank you for your eagle eye finding an issue. Thank you for your time.

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...
Sep 24, 2020 0