Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Capture dropdown response

Avatar

Level 3

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?

0 Replies

Avatar

Level 4

Use 'this.boundItem(xfa.event.newText)' instead of this.rawValue and you'll get the new value instead of the old.

Avatar

Level 3

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.

Avatar

Level 3

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 + ")" );

Avatar

Level 4

I made a little example with 2 textboxes and a combobox.

The form is like this:

example1.jpg

The result is:

example2.jpg

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.

Avatar

Level 3

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?

Avatar

Level 4

Value = this.boundItem(xfa.event.newText)

Text = xfa.event.newText

Avatar

Level 3

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.