[4.10CE] autocomplete issue

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

[4.10CE] autocomplete issue

fabrice etanchaud
Hi all,

I am trying to use the autocomplete component in resource mode.

Here is the problem:

in the autocomplete I am calling http://localhost:8984/commune/ft/fontenay%20le%20c.

the webservice response is (as read by firefox) :

<items><item id="85092">FONTENAY-LE-COMTE</item></items>

but the json sent back to the browser (i can watch it in the firefox network web developer tool) is :

<xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms"><xxf:action><xxf:control-values><xxf:control id="fr-view-wizard≡section-1-control≡xf-435≡control-2-control≡search">fontenay le c</xxf:control><xxf:control id="fr-view-wizard≡section-1-control≡xf-435≡control-2-control≡select1"/><xxf:itemset id="fr-view-wizard≡section-1-control≡xf-435≡control-2-control≡select1">[{"label":"FONTENAY-LE-COMTE","value":"FONTENAY-LE-COMTE"},{"label":"85092","value":"85092"}]</xxf:itemset></xxf:control-values></xxf:action></xxf:event-response>

As you can see, labels and values are messed up.

There could be a problem in the xml to json transformation server side.

Looking forward to hearing from you,

regards,
Fabrice
Reply | Threaded
Open this post in threaded view
|

Re: [4.10CE] autocomplete issue

Alessandro  Vernet
Administrator
Hi Fabrice,

Are you using the autocomplete "by hand", or through Form Builder? In either case, what are your XPath expressions for the items, label, and value? Given the XML you have, I imagine they should look like items: /items/item, label: ., value: @id. Is this what you have?

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

Re: [4.10CE] autocomplete issue

fabrice etanchaud
Hi Alessandro,

Yes, XPath loop : /items/item,
value mapping : @id
label mapping : .

It is very strange this problem has not been detected before.
Is autocomplete used very often ?
I am sorry, even if I have good background in XML technologies, I am still discovering Orbeon for the moment.

Looking forward,
Fabrice
Reply | Threaded
Open this post in threaded view
|

Re: [4.10CE] autocomplete issue

fabrice etanchaud
Hi all,

did anybody find the same issue, or am I missing something ?

Any help will be really appreciated,

best regards,
Fabrice
Reply | Threaded
Open this post in threaded view
|

Re: [4.10CE] autocomplete issue

Alessandro  Vernet
Administrator
Hi Fabrice,

Those expressions look correct. And I think I get the source of your confusion: the response to the Ajax response you're seeing is for a hidden dropdown used by the autocomplete, which "contains first all the label/label, then all the value/value", as noted in a comment in the source:

https://github.com/orbeon/orbeon-forms/blob/tag-release-4.10-ce/src/resources-packaged/xbl/orbeon/autocomplete/autocomplete.xbl#L301

So I think that what you're seeing in the Ajax response is normal. But, I imagine that you were not just looking at the Ajax for fun, but that there was some other problem visible to users, right? In which case, what was the problem, and how could we go about reproducing it?

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

Re: [4.10CE] autocomplete issue

fabrice etanchaud
Hi Alessandro,

first of all, sorry for my late reply.
You were completely right, I did not understand the general behaviour of autocomplete components when used with a webservice : the webservice must return an item when requested with the field's value.

It is not that simple when you deal with free text composed values, aka free text address...

thank you for your great piece of software.
I don't understand why such a technology is not widespread !

native XML database + REST + XForms = fast development !
Reply | Threaded
Open this post in threaded view
|

Re: [4.10CE] autocomplete issue

Alessandro  Vernet
Administrator
Hi Fabrice, thank you for the positive feedback!

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