Selected Text-value of Autocomplete

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Selected Text-value of Autocomplete

johnchikm
How do get the displayed text of a selected item which I need to use in another control?

I can use e.g. $Autocomplete_name to get it's value, but I need the displayed item too.

I thought that @label would work, but alas not.
Reply | Threaded
Open this post in threaded view
|

Re: Selected Text-value of Autocomplete

Alessandro  Vernet
Administrator
Hi John,

You can use $Autocomplete_name/@label. See for instance:
https://gist.github.com/avernet/9f290cf2ed4b5b580448

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Selected Text-value of Autocomplete

johnchikm
Hi Alex,

your example worked fine using the static service, but when we used  a POST webservice, although the autocomplete is correctly populated, using @label did not work. Maybe it is the way the webservice is deployed, but it is difficult to understand how this occurs if the autocomplete is correctly populated.

As a workaround, we set the value field to take the required value AND the label with a  delimiter and split them in XSLT in a further transformation after the form was completed.
Reply | Threaded
Open this post in threaded view
|

Re: Selected Text-value of Autocomplete

Alessandro  Vernet
Administrator
Hi John,

I am not sure to follow you: where does the POST webservice come in? How does it relate to the autocomplete? Is that the service you use to populate the autocomplete? So you're not using the autocomplete in "resource mode"?

And of course, if you're good with your workaround, feel free to ignore my questions :).

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet