-
Notifications
You must be signed in to change notification settings - Fork 14
HelloWorldXForm
Simon Kelly edited this page Feb 5, 2015
·
1 revision
<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>Demonsration XForm</h:title>
<model>
<!-- instance declaration -->
<instance>
<data xmlns="http://dev.commcarehq.org/test/demo" version="1" uiVersion="1">
<name/>
<age/>
<gender/>
</data>
</instance>
<bind id="name" nodeset="/data/name" type="xsd:string" required="true()" />
<bind id="age" nodeset="/data/age" type="xsd:int" required="true()" />
<bind id="gender" nodeset="/data/sex" type="xsd:string" required = "true()" />
<!-- text translations -->
<itext>
<translation lang="en">
<text id="name">
<value form="long">What is the name?</value>
<value form="short">Name</value>
</text>
<text id="age">
<value form="long">What is the age?</value>
<value form="short">Age</value>
</text>
<text id="gender">
<value form="long">What is the gender?</value>
<value form="short">Gender</value>
</text>
<text id="male">
<value form="long">Male</value>
<value form="short">M</value>
</text>
<text id="female">
<value form="long">Female</value>
<value form="short">F</value>
</text>
</translation>
</itext>
</model>
</h:head>
<h:body>
<input bind="name">
<label ref="jr:itext('name')" />
</input>
<input bind="age">
<label ref="jr:itext('age')" />
</input>
<select1 ref="gender">
<label ref="jr:itext('gender')" />
<item>
<label ref="jr:itext('male')" />
<value>M</value>
</item>
<item>
<label ref="jr:itext('female')" />
<value>F</value>
</item>
</select1>
</h:body>
</h:html>