Reputation: 85
I have 2 dropdowns (country_1 and country_2) populate with countries. Both are required. If I choose value some in the country_1 dropdown, the country_2 dropdown should be cleared (value and label).
Example:
I would like to in step 3 the country_2 will have empty label.
I have added value change action to country_1 dropdown, that should clear country_2 dropdown value and label.
Example form: https://demo.orbeon.com/demo/fr/orbeon/builder/edit/bc71b6532f4faee1ec711105a2db00bb65995d80
Source code: https://gist.github.com/mmakos-profidata/9728f086da3abc7bd96af27c8d5a70b8
Upvotes: 0
Views: 129
Reputation: 31743
Moving your code to be inside the <xf:model>
does the trick. I've updated your form on demo.orbeon.com
, but in case it disappears, this is the snippet that I put directly inside the <xf:model>
:
<xf:action event="xforms-value-changed" observer="c_country_1-control">
<xf:action if="//c_country_1 != 'af'">
<xf:setvalue ref="//c_country_2"/>
<xf:setvalue ref="//c_country_2/@label"/>
</xf:action>
</xf:action>
Upvotes: 1