-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature #130: Required and constraint validations
- Loading branch information
1 parent
250a228
commit abbd630
Showing
14 changed files
with
491 additions
and
96 deletions.
There are no files selected for viewing
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
94 changes: 94 additions & 0 deletions
94
packages/ui-solid/fixtures/xforms/validation/1-validation.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?xml version="1.0"?> | ||
<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" xmlns:orx="http://openrosa.org/xforms" | ||
xmlns:odk="http://www.opendatakit.org/xforms"> | ||
<h:head> | ||
<h:title>Validation Form - with a very very very very very very very very very very very long | ||
title</h:title> | ||
<model odk:xforms-version="1.0.0"> | ||
<itext> | ||
<translation lang="default" default="true()"> | ||
<text id="/data/profession:jr:requiredMsg"> | ||
<value>Please enter your profession</value> | ||
</text> | ||
<text id="/data/citizen:jr:constraintMsg"> | ||
<value>It has to be two</value> | ||
</text> | ||
</translation> | ||
<translation lang="Urdu (ur)"> | ||
<text id="/data/profession:jr:requiredMsg"> | ||
<value>اپنا پروفیشن بتائیں</value> | ||
</text> | ||
<text id="/data/citizen:jr:constraintMsg"> | ||
<value>صرف دو ہی ہوسکتی ہیں</value> | ||
</text> | ||
</translation> | ||
</itext> | ||
<instance> | ||
<data id="validation" version="20240708154514"> | ||
<first_name /> | ||
<last_name /> | ||
<profession /> | ||
<favourite_color /> | ||
<citizen /> | ||
<age /> | ||
<meta> | ||
<instanceID /> | ||
</meta> | ||
</data> | ||
</instance> | ||
<instance id="country"> | ||
<root> | ||
<item> | ||
<name>pk</name> | ||
<label>Pakistan</label> | ||
</item> | ||
<item> | ||
<name>ca</name> | ||
<label>Canada</label> | ||
</item> | ||
<item> | ||
<name>us</name> | ||
<label>USA</label> | ||
</item> | ||
</root> | ||
</instance> | ||
<bind nodeset="/data/first_name" type="string" required="true()" /> | ||
<bind nodeset="/data/last_name" type="string" required="true()" | ||
jr:requiredMsg="Please enter the Last Name" /> | ||
<bind nodeset="/data/profession" type="string" required="true()" | ||
jr:requiredMsg="jr:itext('/data/profession:jr:requiredMsg')" /> | ||
<bind nodeset="/data/favourite_color" type="string" constraint=". = "red"" /> | ||
<bind nodeset="/data/citizen" type="string" constraint="count-selected(.) = 2" | ||
jr:constraintMsg="jr:itext('/data/citizen:jr:constraintMsg')" /> | ||
<bind nodeset="/data/age" type="string" required="true()" | ||
constraint=". > 18 and . < 100" jr:constraintMsg="Age has to be between 18 and 100" /> | ||
<bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid" /> | ||
</model> | ||
</h:head> | ||
<h:body> | ||
<input ref="/data/first_name"> | ||
<label>First Name</label> | ||
</input> | ||
<input ref="/data/last_name"> | ||
<label>Last Name</label> | ||
</input> | ||
<input ref="/data/profession"> | ||
<label>Profession</label> | ||
</input> | ||
<input ref="/data/favourite_color"> | ||
<label>Favourite Color</label> | ||
</input> | ||
<select ref="/data/citizen"> | ||
<label>Citizenships</label> | ||
<itemset nodeset="instance('country')/root/item"> | ||
<value ref="name" /> | ||
<label ref="label" /> | ||
</itemset> | ||
</select> | ||
<input ref="/data/age"> | ||
<label>Age</label> | ||
</input> | ||
</h:body> | ||
</h:html> |
Oops, something went wrong.