Additional help needed for Script behind form fields in Acrobat

New Here ,
Aug 31, 2022 Aug 31, 2022

Copy link to clipboard

Copied

When I had to convert a LiveCycle form in Acrobat, all script was stripped behind the form fields. In the LC form, when a server is selected from a drop-down field, it populates fields with data. But, if a server name not listed in the drop-down list is manually entered in the field, the users want the other fields to retain the information populated when a listed server was selected. For example, if a user selects server A1 or B1, the Login field enters Administrator in the field). But, if the user manually enters something like YourServer (after selecting A1 or B1), they want the login field value to remain as Administrator. Here is the script for the Login field. Can the script be modified to retain the Login field values if server A1 or B1 is selected but then changed to a different server name altogether?

 

if (event.source!=null && event.source.name=="ServerName1") {var v = this.getField("ServerName1").valueAsString;

if (v=="A1") event.value = "Administrator";

else
if (v=="B1") event.value = "Administrator";

else event.value = "";
}

 

Thank you for any help you can provide.

TOPICS
PDF forms

Views

21

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
community guidelines
Community Expert ,
Aug 31, 2022 Aug 31, 2022

Copy link to clipboard

Copied

LATEST

You can use script in "ServerName1" as 'Validation' script, and change 'else' to reset "Login field" only if default choice is selected, something like '-Please select server-', and since for both choices "A1" and "B1" value is "Administrator" you can use ||(or)  something like this:

var LF = this.getField("Login field");
if(event.value == "A1" || event.value == "B1")
LF.value = "Administrator";
else if(event.value == "-Please select server-")
LF.value = "";

 

"Administrator" will remain in "Login field" if user type something else, and it can even manually type something else in "Login field" if needed, if "-Please select server-" is selected then it will empty "Login field".

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
community guidelines