adobe livecycle script convert to adobe pro

Explorer ,
Sep 22, 2020 Sep 22, 2020

Copy link to clipboard

Copied

Hi, i want to recreate the adobe LiveCycle form in adobe pro. in one multiline text field has a script to limit 200 words so i want to add same javascript to my new PDF form. can u pls help me to convert bellow code that works on adobe pro from. thanks..

 

var f=xfa.event.newText;
var aWords = f.split(" ");
var nNumWords = aWords.length;
WordCount.rawValue="Word Count - "+nNumWords;

if(nNumWords > 200){
WordCount.rawValue="Word Count - 200";
xfa.event.change = "";
xfa.host.messageBox("Maximum Word Count Reached");
}

 

not exceeding 200 words.JPG

TOPICS
Acrobat SDK and JavaScript

Views

70

Likes

translate

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

Copy link to clipboard

Copied

Hi,

 

(small caveat, doing this from memory but should be most of the changes)

 

var f = event.value;

var aWords = f.split(" ");
var nNumWords = aWords.length;

this.getField("WordCount").value = "Word Count - " + nNumWords;

if(nNumWords > 200){
WordCount.rawValue="Word Count - 200";

app.alert ( "Maximum Word Count Reached"):

}

 

Assuming you are running it on the field that you want to count, this should about do it.

 

Regards

 

Malcolm

Likes

translate

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
Explorer ,
Sep 22, 2020 Sep 22, 2020

Copy link to clipboard

Copied

hi, thanks a lot for your help. so where i should add your code in text field properties ?? i mean is this "custom validation script "??. thanks..

Likes

translate

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
Explorer ,
Sep 22, 2020 Sep 22, 2020

Copy link to clipboard

Copied

hi, here is the link for the original form. that text field is on page #6.

form 

 

Likes

translate

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