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");
}
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
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..
Copy link to clipboard
Copied