Hi
I have the following piece of code that tries to populate a select1 control with the resultset XML returned from an XML response from an XML server. I would like to avoid pressing a trigger to make the submission happen and hence populate the instance. ( which I have done already)
So, ideally this is what I want to achieve: The submission has to be triggered only when I access the dropdown with my box. I am not sure if that is possible though. That is, when the XForm loads, the select1 control should be empty and when I try to access this empty dropdown, it is when the dropdown needs to be populated at that point of time. Can that happen and if so how?
Thanks for any suggestions.
...
<xf:submission
id="sub-get-hair-data"
action="http://localhost:9001/SimpleXmlServer/XmlIntercept/lists/HairPath"
method="get"
replace="instance"
instance="HResponse"
/>
...
<xf:group ref="instance('HairResponse')">
<xhtml:div>
<xf:select1 style="width:150px;border: 3px ridge #643;padding: 2px;" appearance="minimal" ref="instance('HResponse')">
<xf:label style="padding-top: 9px;">H Color Code:</xf:label>
<xf:hint></xf:hint>
<xf:help></xf:help>
<xf:alert></xf:alert>
<xf:itemset nodeset="item">
<xf:label ref="ha_description"/>
<xf:value ref="ha_value"/>
</xf:itemset>
<xf:action ev:event="xforms-value-changed">
<xf:send submission="sub-get-hair-data"/>
</xf:action>
</xf:select1>
</xhtml:div>
</xf:group>
...

You can use DOMFocusIn
Instead of just triggering a submission with the xforms-value-changed you can use the DOMFocusIn event with the @if attribute to conditionally check to see if the xf:itemset data exists and, if it doesn't, populate it.
Something like:
... <xf:select1 ref="instance('inst-y')"> <xf:label>Choose something</xf:label> <xf:itemset nodeset="instance('inst-x')/x"> <xf:label ref="." /> <xf:value ref="." /> </xf:itemset> <xf:action ev:event="DOMFocusIn" if="not(instance('inst-x')/x)"> <xf:message level="modal">No xf:itemset data currently exists</xf:message> ... </xf:action> <xf:action ev:event="xforms-value-changed"> ... </xf:action> </xf:select1> ...result of select1 stored in the node
I found that similarly to the checkboxes the value selected in a select1 are stored.
Thanks
ilango
storing the result of the select1
Is it possible also to store the result of a select1 just as in the case of checkboxes? Thanks again.
ilango