Created
March 5, 2013 12:25
-
-
Save olafveerman/5089981 to your computer and use it in GitHub Desktop.
XForm - constraint based on answer of previous question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
<h:head> | |
<h:title>constraint</h:title> | |
<model> | |
<instance> | |
<constraint id="constraint"> | |
<age/> | |
<min_years_smoked/> | |
<years_smoked/> | |
<meta> | |
<instanceID/> | |
</meta> | |
</constraint> | |
</instance> | |
<bind constraint=".>= 12 and .<=100" nodeset="/constraint/age" type="int"/> | |
<bind calculate=" /constraint/age - 12" nodeset="/constraint/min_years_smoked" type="string"/> | |
<bind constraint=".<= /constraint/min_years_smoked and .<= 65" nodeset="/constraint/years_smoked" type="int"/> | |
<bind calculate="concat('uuid:', uuid())" nodeset="/constraint/meta/instanceID" readonly="true()" type="string"/> | |
</model> | |
</h:head> | |
<h:body> | |
<input ref="/constraint/age"> | |
<label>How old are you?</label> | |
</input> | |
<input ref="/constraint/years_smoked"> | |
<label>How many years have you smoked</label> | |
</input> | |
</h:body> | |
</h:html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment