Okay, small issue, I can't figure out how to grab the first word from several in a text box. Here is the code that captures the full line:
var LSTN = "LSTN"+xfa.form.OUTSTCHK12.FormPage1.Subform1.PayeeLastName.rawValue;
If someone could please help I would be very greatful.
Solved! Go to Solution.
Views
Replies
Total Likes
Well now that you know ho to get the word it is simply a case of assigning it to another field. Assuming the other field is called OtherField you would use a command like this:
OtherField.rawValue = words[0]
Paul
Views
Replies
Total Likes
You can use javascript functions for that. Assuming your field that holds the sentence is PayeeLastName then you can do something like this:
// Get value into a string
var message = PayeeLastName.rawValue;
//Use the split command to break up the string on the space char and place into an array called words
var words = message.split(" ");
//now the words array holds all of the words in the string. It is a zero base array so to get the 1st word
app.alert("The first word is: " + words[0]);
Hope that helps
Paul
Your answer was helpful but I believe I phrased my question wrong, is there a way to grab just the first word and have it fill a different box instead of having the app.alert for the word.
Thanks
PS: Would it be possible to only change part of the code that I pasted to grab the first word and continue to place it where it's set to do so?
Views
Replies
Total Likes
Well now that you know ho to get the word it is simply a case of assigning it to another field. Assuming the other field is called OtherField you would use a command like this:
OtherField.rawValue = words[0]
Paul
Views
Replies
Total Likes
Thank you for helping me out, it is greatly appreciated.
Views
Replies
Total Likes
Views
Likes
Replies