public
Created

Disabling a specific radio button with XForms

  • Download Gist
gistfile1.xml
XML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
<xhtml:head>
<xforms:model>
<xforms:instance>
<instance>
<add/>
<delete/>
<add-delete/>
<delete-enabled>true</delete-enabled>
</instance>
</xforms:instance>
<xforms:bind ref="add-delete" calculate="string-join((../add, ../delete), ' ')"/>
<xforms:bind ref="delete" readonly="../delete-enabled = 'false'"/>
</xforms:model>
</xhtml:head>
<xhtml:body>
<xforms:trigger>
<xforms:label>Toggle delete enabled</xforms:label>
<xforms:setvalue ev:event="DOMActivate" ref="delete-enabled" value="if (. = 'true') then 'false' else 'true'"/>
</xforms:trigger>
<xforms:output ref="instance()/add-delete"/>
<xforms:select1 ref="instance()/add" appearance="full">
<xforms:item>
<xforms:label>Add</xforms:label>
<xforms:value>A</xforms:value>
</xforms:item>
<xforms:setvalue ev:event="xforms-select" ref="instance()/delete"/>
</xforms:select1>
<xforms:select1 ref="instance()/delete" appearance="full">
<xforms:item>
<xforms:label>Delete</xforms:label>
<xforms:value>D</xforms:value>
</xforms:item>
<xforms:setvalue ev:event="xforms-select" ref="instance()/add"/>
</xforms:select1>
</xhtml:body>
</xhtml:html>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.