Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

adobe livecycle script convert to adobe pro

Participant ,
Sep 22, 2020 Sep 22, 2020

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

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

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

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..

Translate
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
Participant ,
Sep 22, 2020 Sep 22, 2020
LATEST

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

form 

 

Translate
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