Autocomplete: struggling with labelref

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

Autocomplete: struggling with labelref

Heinrich Götzger

I'd like to use the labelref-feature with the autocomplete component.
But for some reason this is not working as expected.

Using orbeon 2016.2 CE or orbeon 4.5.0 CE it's still the same behavior,
There is no label stored in the labelref-instance.

What's wrong with the following (simplified) example:


       <xh:title>Autocomplete - Example</xh:title>
       <xf:model id="ac-model">

          <xf:instance id="country">

          <xf:instance id="all-countries">
                   <name>European Union</name>




          <xf:label>Search country</xf:label>
          <xf:itemset ref="instance('all-countries')/country">
             <xf:value ref="us-code"/>
             <xf:label ref="name"/>

       <xf:output ref="country">
          <xf:label>Country: </xf:label>

       <xf:output ref="countryName">
          <xf:label>Country Name: </xf:label>



Before printing this e-mail, think about our environmental responsibility.

You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view

Re: Autocomplete: struggling with labelref

Alessandro  Vernet
Hi Heinrich,

Simple: `labelref` is only supported in resource and dynamic mode, not in static mode. The idea being that in static mode you generally don't need to store the label since you have the full instance available right there. However, in resource or dyanmic mode, you *need* to store the label, as you typically can't get the label from the value, only the other way around, as the service you call typically uses the label for search.

If you're in static mode, either don't store the label (for sure it isn't needed by the autocomplete itself in static mode), or if you need it for some other reason, do it with an <xf:bind calculate="…">. Would that work for you?

And BTW, this is a control which would benefit from a refresh! :)

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