[Chiba-users] select other - How to initializing a switch based on a list value
Creators discontinued Chiba & founded betterFORM http://betterform.de
Brought to you by:
chibaxforms,
windauer
From: Diego B. <die...@di...> - 2008-03-18 09:57:29
|
Hello, I'm having trouble figuring out how to initialize a switch/case based on instance data. I have to following 'color' select1 element: <xforms:select1 id="input_color" xforms:bind="bind_color"> ... <xforms:item> <xforms:label>Other</xforms:label> <xforms:value>_other_</xforms:value> <xforms:action ev:event="xforms-select"> <xforms:toggle case="showOther"/> </xforms:action> <xforms:action ev:event="xforms-deselect"> <xforms:toggle case="hideOther"/> </xforms:action> </xforms:item> </xforms:select1> Which nicely triggers show/hide of the 'other' input: <xforms:switch> <xforms:case id="showOther"> <xforms:input id="input_other" xforms:bind="bind_other"> <xforms:label>Extra</xforms:label> </xforms:input> </xforms:case> <xforms:case id="hideOther" selected="true"> <!-- nothing here --> </xforms:case> </xforms:switch> My problem happens on a later redisplay of that form/instance, when instance exists, selected 'color' is already '_other_' but the 'hideOther' case is selected by default, so 'other' input is not shown. I was trying to use a toggle element with ev:event="xforms-ready" but it takes an IDREF for the case attribute and not an expression... Has anybody faced similar situation? Can anybody point the direction to solve this? Btw, I'm using a very old and patched chiba version, ~1.0.0, and it is still working. ;) Thanks, Diego -- Diego Ballve Digital Artefacts Europe http://www.digital-artefacts.fi/ |