tags:

views:

12

answers:

1

I have a drop down with 2 options "Upload File", "Add URL". If user selects Upload file, my form will display a file selector. If user selects Add URL, the form will hide the file selector and instead display a textbox. I have done this using relevancy.

<xforms:bind nodeset="./document" relevant="instance('test')/uploadMethod='Upload File'"/>
<xforms:bind nodeset="./documentURL" relevant="instance('test')/uploadMethod='Add URL'" />

File Selector will add file information to document tag. Textbox data will get saved in documentURL tag.

User chooses to Upload File and uploads a file and saves the XML. In the saved XML, I no longer see the tag. I have a use case where user must be able to edit this XML and he can choose to Add URL. The issue is this. Because the saved XML does not contain the tag, the textbox does not get displayed on the form.

Could anybody please help with this? I need to be able to let the user see the file selecor or textbox based on what he chooses in the dropdown, in edit mode.

+1  A: 

If you have the elements in the instance, but they are not there anymore after the instance is submitted, it might be because you have "relevance pruning" on, which will remove from the submitted XML all the non-relevant nodes. You would solve this by removing the relevant="true" attribute you may have on the <xforms:submission> element.

Alessandro Vernet