开发者

XForms: Setting relevant removes tag from XML

开发者 https://www.devze.com 2023-01-12 08:38 出处:网络
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 ins

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号