cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard In Public" <>
Subject XmlForm Validation Problem: Where Am I Going Wrong?
Date Fri, 07 Mar 2003 00:48:03 GMT

I think I'm pretty close to having things up and running with XMLForms.  I'm
having some problems with the validation though.  I'm trying to achieve
conditional validation:  I have two password fields and the second should
only be effected if a password has been entered in the first.  I don't want
to do this in the '/' content as I want any violations to be associated with
the second field.  I've tried everything that I can think of.  Here is one
of the attempts. Everything works except the validation of the second
password field.  No violations are reported when I fill in only the first
field.  Where am I going wrong?

My my dead lines are turning pale blue and gasping for breath.  Please
please help me!


------------------------ Validation Schema(tron) ---------------------
<?xml version="1.0" ?>
<schema ns="http://xml.apache.cocoon/xmlform"
<title>Account Registration Schema</title>
<phase id="registration">
<p>For user identity information.</p>
<active pattern="reg"/>
<pattern name="User Info Validation Pattern" id="reg">
<rule context="/emailAddress">
<assert test="contains( string(.),'@')">
Email format is invalid.
<rule context="/password">
<assert test="string-length(.) &gt; 7">
Password should be at least 8 characters.
<assert test="string-length(.) &lt; 20">
Password should be less than 20 characters.
<rule context="/repeatedPassword">
<report test="(string-length(/password) &gt; 0) and (string-length(.) = 0)">
Please confirm your password.
XMLForm --------------------------------
<?xml version="1.0" ?>
<xf:form xmlns:xf=""
id="form-feedback" view="registration" action="new-account.xml"
<xf:violations class="error"/>
<xf:textbox ref="/emailAddress">
<xf:caption>Email Address</xf:caption>
<xf:violations class="error" />
<xf:password ref="/password">
<xf:violations class="error" />
<xf:password ref="/repeatedPassword">
<xf:caption>Password (Confirm)</xf:caption>
<xf:violations class="error" />
<xf:textbox ref="/firstName">
<xf:caption>First Name</xf:caption>
<xf:violations class="error" />
<xf:textbox ref="/lastName">
<xf:caption>Last Name</xf:caption>
<xf:violations class="error" />
<xf:textbox ref="/phoneNumber">
<xf:caption>Phone Number</xf:caption>
<xf:violations class="error" />
<xf:textbox ref="/address1">
<xf:caption>Line 1</xf:caption>
<xf:violations class="error" />
<xf:textbox ref="/address2">
<xf:caption>Line 2</xf:caption>
<xf:violations class="error" />
<xf:textbox ref="/address3">
<xf:caption>Line 3</xf:caption>
<xf:violations class="error" />
<xf:textbox ref="/city">
<xf:violations class="error" />
<xf:textbox ref="/postCode">
<xf:caption>Post Code</xf:caption>
<xf:violations class="error" />
<xf:textbox ref="/countryID">
<xf:violations class="error" />
<xf:submit id="next" class="button">
<xf:caption>Create My Account</xf:caption>
<xf:hint>Go to next page</xf:hint>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message