First initial + last name= login name...
Text field + text field = text field....
can I use javascript to generate the loginname form first name (first Int) and last name???
For ex... First name: John
middle int: k
last Name: Doe
LoginName: jdoe
var LoginName = getField("LastName").value;
var FirstName = getField("FirstName").value;
if (FirstName!="")
LoginName += " " + FirstName.substring(0,1) + "."
event.value = LoginName;
not sure if this is right... please help
Solved! Go to Solution.
Views
Replies
Total Likes
You guys are both using Acrobat JS notation so you're not going to have much luck.
In LC there's no getField or event.value and values are returned from fields using fieldName.rawValue (or .formattedValue).
I put this on the Calculate event of the LoginName field:
var vFirstName = FirstName.rawValue;
var vLastName = LastName.rawValue;
if (!(FirstName.isNull || LastName.isNull)) { // if both fields have data
this.rawValue = vFirstName.substring(0,1) + vLastName;
}
Views
Replies
Total Likes
Hi,
I think you code is a little off as I believe it would result in "doej" which is not what you want.
If you change it to this
var FirstName = getField("FirstName").value;
var LastName = getField("LastName").value;
if (FirstName!="")
{
event.value = FirstName.substring(0,1) + LastName; // this should return jdoe
}
else
{
event.value = LastName;
}
Hope this helps
Malcolm
You guys are both using Acrobat JS notation so you're not going to have much luck.
In LC there's no getField or event.value and values are returned from fields using fieldName.rawValue (or .formattedValue).
I put this on the Calculate event of the LoginName field:
var vFirstName = FirstName.rawValue;
var vLastName = LastName.rawValue;
if (!(FirstName.isNull || LastName.isNull)) { // if both fields have data
this.rawValue = vFirstName.substring(0,1) + vLastName;
}
Views
Replies
Total Likes
Jono Moore....
That's scary that know lol... thanks for your help man, that worked perfectly...
Views
Replies
Total Likes
Views
Likes
Replies