Skip to content

Instantly share code, notes, and snippets.

@yosemitebandit
Created October 19, 2012 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yosemitebandit/3915697 to your computer and use it in GitHub Desktop.
Save yosemitebandit/3915697 to your computer and use it in GitHub Desktop.
attempting conditional select items using itemsets (http://goo.gl/Z6QQO)
<?xml version="1.0" encoding="UTF-8" ?>
<h:html xmlns:h="http://www.w3.org/1999/xhtml" xmlns:orx="http://openrosa.org/jr/xforms" xmlns="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
<h:head>
<h:title>location location location</h:title>
<model>
<instance>
<data xmlns:jrm="http://dev.commcarehq.org/jr/xforms" xmlns="http://openrosa.org/formdesigner/4DCD3A18-692B-4BA4-BC5A-A863D1C766FA" uiVersion="1" version="1" name="location location location">
<name />
<province />
<district />
</data>
</instance>
<instance id="provinces" src="jr://fixture/item-list:province"></instance>
<instance id="districts" src="jr://fixture/item-list:district"></instance>
<bind nodeset="/data/name" type="xsd:string" />
<bind nodeset="/data/province" />
<bind nodeset="/data/district" />
<itext>
<translation lang="en" default="">
<text id="name-label">
<value>name</value>
</text>
<text id="province-label">
<value>Province</value>
</text>
<text id="district-label">
<value>District</value>
</text>
</translation>
</itext>
</model>
</h:head>
<h:body>
<input ref="/data/name">
<label ref="jr:itext('name-label')" />
</input>
<select1 ref="/data/province">
<label ref="jr:itext('province-label')" />
<itemset nodeset="instance('provinces')/province_list/province">
<label ref="name"></label>
<value ref="id"></value>
</itemset>
</select1>
<select1 ref="/data/district">
<label ref="jr:itext('district-label')" />
<itemset nodeset="instance('districts')/district_list/district[province_id = /data/province]">
<label ref="name"></label>
<value ref="id"></value>
</itemset>
</select1>
</h:body>
</h:html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment