A while back I had a consultant build me a form that performs a look-up to EDCPRINCIPALENTITY to resolve names. It takes result and populates a downdown list to present a list of matching user name. The user can then select a name from the list and the response gets bound to their Login-ID. Works great. Unfortunately, this particular workflow has a secondary assignment step where the next user can see the prior response from the previous user and the form uses the same logic.
I've partially corrected my problem. I need to grab value from a login variable that the user selected from the dropdown and assign it to the name variable. Should be easy enough. But for some reason it is only grabbing the value of that very last item in the drop-down list rather than the value that the user selected. I've got the problem narrowed down to somewhere in the following code:
parent.login.addItem(lastName
+ ", " + firstName + " (" + titleName + ")", login );
if (first == 1) {
first
= 0;
firstID
= login;
}
pos
= currentStr.indexOf('<Login type="VARCHAR2">', pos);
firstPos
= currentStr.indexOf('<FirstName type="VARCHAR2">', firstPos);
lastPos
= currentStr.indexOf('<LastName type="VARCHAR2">', lastPos);
titlePos
= currentStr.indexOf('<Title type="VARCHAR2">', titlePos);
}
// Set default value to the first item in the list.
parent.login.rawValue
= firstID;
parent.name.rawValue
= pos;
parent.name.presence
= "invisible";
parent.login.presence
= "visible";
parent.btn_clear.presence
= "visible";
parent.btn_search.presence
= "invisible";
So if I change line "parent.name.rawValue = lastName + ", " + firstName + " (" + titleName + ")";
Then the data is formatted the way I want ...but it selects the last value that was in the drop-down list, rather than what the user selected. How do I transfer the value selected from my "login" variable in the dropdown box into my "name" variable which will be presented into a simple text box?
Views
Replies
Total Likes
Use 'this.boundItem(xfa.event.newText)' instead of this.rawValue and you'll get the new value instead of the old.
Views
Replies
Total Likes
Pardon me as I don't come from a developer background so I gotta be beat over the head. I tried two different things that didn't work. Perhaps you can help me with my syntax.
I tried:
parent.name.rawValue = parent.login.boundItem(xfa.event.newText);
The name box is empty using this.
and I tried:
parent.name.rawValue = parent.login.boundItem(xfa.event.(firstName + " " + lastName +" (" + titleName + ")");
The script doesn't function at all so this is obviously very wrong.
Basically, I want the name to return the select value in the following format:
(firstName + " " + lastName +" (" + titleName + ")"
Perhaps you can help me with the syntax? I'm a rookie with form scripting.
Views
Replies
Total Likes
As a clarification, the following syntax works but doesn't capture the input from the user, it only captures the last item in the list.
parent.name.rawValue = (firstName + " " + lastName +" (" + titleName + ")" );
Views
Replies
Total Likes
I made a little example with 2 textboxes and a combobox.
The form is like this:
The result is:
Whenever you change the selected value in the combo it will get the new value instead of the old.
Note that only the combo needs to bind the change event in order to get the new value.
Hope this helps.
Views
Replies
Total Likes
Thanks for the examples. This helps us to get the actual value of the item that was selected. However, at this point we are also attempting to retrieve the text that is displayed for the selected item. Is it possible to obtain this value also?
Views
Replies
Total Likes
Value = this.boundItem(xfa.event.newText)
Text = xfa.event.newText
Views
Replies
Total Likes
That did it. Thanks so much for your help!
Final solution in my example:
Approvers_subform.approvers.login::change
this.resolvedNode ("approvers.name").rawValue = xfa.event.newText;
Phew. The boundItem was throwing me off but once I removed that it works perfect. Again. Thanks.
Views
Replies
Total Likes
Views
Likes
Replies