Could not clear selection in dynamic dropdown using event

14 views
Skip to first unread message

Alessandro Vernet

unread,
Dec 4, 2020, 9:11:58 PM12/4/20
to orb...@googlegroups.com
I am following up here to a question (see 1st link below) about resetting the
value of a dropdown with search when the value of another dropdown with
search changes.

Our recommendation is to always put custom XForms in the model, to minimize
the risk of your code being overwritten by Form Builder, or otherwise
causing Form Builder to get "confused". And beyond prototyping, I'd strongly
recommend you put it in a separate file referenced from your properties (see
2nd link below).

Assuming the 2 dropdowns are named `country-1` and `country-1`, the XForms
would do:

<xf:action event="xforms-value-changed" observer="country-1-control">
<xf:setvalue ref="//country-2"/>
</xf:action>

You can see here how the value in the 2nd dropdown is reset when the value
in the 1st one is changed: reset-on-value-change.gif
<http://discuss.orbeon.com/file/t119778/reset-on-value-change.gif> .
And here is the source this form: form.xml
<http://discuss.orbeon.com/file/t119778/form.xml> .

https://github.com/orbeon/orbeon-forms/issues/4717
https://doc.orbeon.com/form-runner/advanced/custom

I hope this helps,

-Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/
Reply all
Reply to author
Forward
0 new messages