Lock Fields on Validation?

New Here ,
Jan 08, 2018

Copy link to clipboard

Copied

I want to have 2 text fields lock but only after a correct validation of proper initials from an individual. I have a script to lock fields and s script to validate. How do I put the two together?

Validate:

event.rc = true;

if (event.value != "" && event.value != "AAAA" && event.value != "BBBB")

{

    app.alert("The entered value needs to be either 'AAAA' or 'BBBB'!");

    event.rc = false;

}

Lock:

var fieldsToLock = ["TimeField309", "TimeField317"];

for (var i in fieldsToLock) this.getField(fieldsToLock)

How do I put these 2 together for the proper result I'm looking for?

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

118

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

Lock Fields on Validation?

New Here ,
Jan 08, 2018

Copy link to clipboard

Copied

I want to have 2 text fields lock but only after a correct validation of proper initials from an individual. I have a script to lock fields and s script to validate. How do I put the two together?

Validate:

event.rc = true;

if (event.value != "" && event.value != "AAAA" && event.value != "BBBB")

{

    app.alert("The entered value needs to be either 'AAAA' or 'BBBB'!");

    event.rc = false;

}

Lock:

var fieldsToLock = ["TimeField309", "TimeField317"];

for (var i in fieldsToLock) this.getField(fieldsToLock)

How do I put these 2 together for the proper result I'm looking for?

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

119

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
Jan 08, 2018 0
Adobe Community Professional ,
Jan 08, 2018

Copy link to clipboard

Copied

You can use:

if ( ... ) {

} else {

}

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...
Jan 08, 2018 0
Most Valuable Participant ,
Jan 08, 2018

Copy link to clipboard

Copied

Why are you using a text field, then? Use a drop-down field and the user will have to select one of the allowed options.

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...
Jan 08, 2018 0
New Here ,
Jan 08, 2018

Copy link to clipboard

Copied

A time will go in the text field to be locked, which could be any time of the day. Too many options for a dropdown.

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...
Jan 08, 2018 0
try67 LATEST
Most Valuable Participant ,
Jan 08, 2018

Copy link to clipboard

Copied

I'm talking about the original text field, the one with "AAAA" or "BBBB" options...

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...
Jan 08, 2018 0