I am trying to find a way to divide the rawvalue of an input field into its component words
so if field A has a vlaue of "Julia Alison Child"
i would like to be able to cut that up into Firstname Middlename and Lastname fileds
I susepct it can be done using grep by determining when the first and second spaces occur
and taking everything before that for field onei.e Firstname
everything after that and before the second for Middlename and everythign after the second space for Lastname.
Conseptually it's simpe enough but I cant scavange a workign code sample and my coding isnt up to the job
....
anyone seen anythign like this before?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
try this method.
var Input = Textfield1.rawValue;
var NameParts = Input.split("\u0020");
if (NameParts.length === 1)
{
FirstName.rawValue = NameParts.slice(0,1).toString();
MiddleName.rawValue = "";
LastName.rawValue = "";
}
if (NameParts.length === 2)
{
FirstName.rawValue = NameParts.slice(0,1).toString();
MiddleName.rawValue = "";
LastName.rawValue = NameParts.slice(1,2).toString();
}
if (NameParts.length === 3)
{
FirstName.rawValue = NameParts.slice(0,1).toString();
MiddleName.rawValue = NameParts.slice(1,2).toString();
LastName.rawValue = NameParts.slice(2,3).toString();
}
Views
Replies
Total Likes
Hi,
try this method.
var Input = Textfield1.rawValue;
var NameParts = Input.split("\u0020");
if (NameParts.length === 1)
{
FirstName.rawValue = NameParts.slice(0,1).toString();
MiddleName.rawValue = "";
LastName.rawValue = "";
}
if (NameParts.length === 2)
{
FirstName.rawValue = NameParts.slice(0,1).toString();
MiddleName.rawValue = "";
LastName.rawValue = NameParts.slice(1,2).toString();
}
if (NameParts.length === 3)
{
FirstName.rawValue = NameParts.slice(0,1).toString();
MiddleName.rawValue = NameParts.slice(1,2).toString();
LastName.rawValue = NameParts.slice(2,3).toString();
}
Views
Replies
Total Likes
Hi Radzmar - thanks for the code - perfect.........
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies