Skip to main content
Known Participant
September 22, 2020
Question

adobe livecycle script convert to adobe pro

  • September 22, 2020
  • 1 reply
  • 465 views

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");
}

 

This topic has been closed for replies.

1 reply

BarlaeDC
Community Expert
Community Expert
September 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

omanbuxAuthor
Known Participant
September 23, 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..

omanbuxAuthor
Known Participant
September 23, 2020

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

form