These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Script needed

patra
Registered: Oct 19 2006
Posts: 270
Answered

I have a text field with limit characters 6 digits and on exit event the validation below:

if (this.rawValue.length < 6)
{
app.alert("This field requires 6 digits");
xfa.host.setFocus(this); }

This I like to achive is when the first 3 digits of the 6 starts with 333 I"ll like to genarate
the value: xxx [at] xxx [dot] com into a textField named EmailAddress.
In case there is any other number compinazation than starting with 333 EmailAddress value to be
empty!

Is this possible?

Thnk you

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
That is not a problem.

Put this script into the change:event of the text field.
if(xfa.event.newText == "333"){EmailAddress.rawValue = "<span class="spamspan"><span class="u">aaa</span> [at] <span class="d">www [dot] org</span></span>";}else{EmailAddress.rawValue = "";}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

patra
Registered: Oct 19 2006
Posts: 270
The digits users enter are 6.
If the first 3 digits are 333 for example 333457 I'll like to genarate
the value: xxx [at] xxx [dot] com into a textField named EmailAddress otherwise
EmailAddress.rawValue = "";

Thanks radzmar
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Ah ok,

this can easily be done with FormCalc.

var ChkInput = left(xfa.event.newText, 3) if(ChkInput == "333") thenEmailAddress.rawValue = "<span class="spamspan"><span class="u">xxx</span> [at] <span class="d">xxx [dot] org</span></span>"elseEmailAddress.rawValue = ""endif

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs