Wiki
Clone wikijavarosa / TrainingForm7
<h:html xmlns="http://www.w3.org/2002/xforms"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jr="http://openrosa.org/javarosa">
<h:head>
<h:title>Demo Form</h:title>
<model>
<instance>
<!-- the XML inside here is what gets filled out and submitted when you complete the form -->
<student>
<form_version>0.0.2</form_version>
<name />
<city>DAR ES SALAAM</city>
<sex />
<age />
<grad_date />
<interests />
<certifications />
</student>
</instance>
<!-- binds allow us to add properties to the questions, like data types, skip logic, etc.-->
<bind nodeset="name" required="true()" />
<bind nodeset="age" type="int" constraint=". < 120" jr:constraintMsg="Age cannot be above 120!" />
<bind nodeset="grad_date" type="date" constraint=". > today()" jr:constraintMsg="Graduation day must be in the future!" />
<bind nodeset="certifications" constraint="not(selected(., 'unknown') and count-selected(.) > 1)" jr:constraintMsg="'Don't know' can't be chosen in combination with other certifications" />
</model>
</h:head>
<h:body>
<!-- This is where we define the questions that the user will fill out -->
<input ref="name">
<label>What is your name?</label>
</input>
<input ref="city">
<label>What city do you live in?</label>
</input>
<select1 ref="sex">
<label>Are you male or female?</label>
<item>
<label>Male</label>
<value>m</value>
</item>
<item>
<label>Female</label>
<value>f</value>
</item>
</select1>
<input ref="age">
<label>How old are you?</label>
</input>
<input ref="grad_date">
<label>When will you graduate?</label>
</input>
<select ref="interests">
<label>What are your interests?</label>
<item>
<label>Eating Ugali</label>
<value>ugali</value>
</item>
<item>
<label>Watching TV</label>
<value>tv</value>
</item>
<item>
<label>Music</label>
<value>music</value>
</item>
<item>
<label>Making XForms</label>
<value>xforms</value>
</item>
</select>
<select ref="certifications">
<label>What are your certifications?</label>
<item>
<label>XForm Fundi</label>
<value>xform_fundi</value>
</item>
<item>
<label>TSO</label>
<value>tso</value>
</item>
<item>
<label>CBEX</label>
<value>cbex</value>
</item>
<item>
<label>Don't know</label>
<value>unknown</value>
</item>
</select>
</h:body>
</h:html>
Updated