Hello,
I couldn't solve your problem but maybe I can give you more ideas...
In you rule:
rule context=/repeatedPassword
report test=(string-length(/password) gt; 0) and (string-length(.) =
0)
Please confirm your password.
/report
/rule
I would say you are setting the context to /repeatedPassword, so
/password won't work. I think you should use ../password in there. I
coudn't make this work either...ummm...but if I put any text in the
/repeatedPassword field, form does not pass validation and it does if I
leave it blank...weird...
Anyway, if you got it working you should consider writing a more consistent
rule for password confirming. Something like:
rule context=/repeatedPassword
assert test=string(.) = string(../password)
Please confirm your password.
/assert
/rule
I can think of another way of making this, through some java code in the
perform() method (making validation programatically), but I hope it won't be
necessary cause I believe there must be a Schematron way of doing this. Hope
someone could help you (us) more :-)
Best,
Josema
- Original Message -
From: Richard In Public [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 07, 2003 1:48 AM
Subject: XmlForm Validation Problem: Where Am I Going Wrong?
Hi
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!
Richard
Validation Schema(tron) -
?xml version=1.0 ?
schema ns=http://xml.apache.cocoon/xmlform;
xmlns=http://www.ascc.net/xml/schematron;
titleAccount Registration Schema/title
phase id=registration
pFor user identity information./p
active pattern=reg/
/phase
pattern name=User Info Validation Pattern id=reg
rule context=/emailAddress
assert test=contains( string(.),'@')
Email format is invalid.
/assert
/rule
rule context=/password
assert test=string-length(.) gt; 7
Password should be at least 8 characters.
/assert
assert test=string-length(.) lt; 20
Password should be less than 20 characters.
/assert
/rule
rule context=/repeatedPassword
report test=(string-length(/password) gt; 0) and (string-length(.) =
0)
Please confirm your password.
/report
/rule
/pattern
/schema
XMLForm
?xml version=1.0 ?
xf:form xmlns:xf=http://xml.apache.org/cocoon/xmlform/2002;
id=form-feedback view=registration action=new-account.xml
xmlns:site=http://designedandmanaged.net/cocoon/site/1.0;
error
xf:violations class=error/
/error
xf:textbox ref=/emailAddress
xf:captionEmail Address/xf:caption
xf:violations class=error /
/xf:textbox
xf:password ref=/password
xf:captionPassword/xf:caption
xf:violations class=error /
/xf:password
xf:password ref=/repeatedPassword
xf:captionPassword (Confirm)/xf:caption
xf:violations class=error /
/xf:password
xf:textbox ref=/firstName
xf:captionFirst Name/xf:caption
xf:violations class=error /
/xf:textbox
xf:textbox ref=/lastName
xf:captionLast Name/xf:caption
xf:violations class=error /
/xf:textbox
xf:textbox ref=/phoneNumber
xf:captionPhone Number/xf:caption
xf:violations class=error /
/xf:textbox
xf:textbox ref=/address1
xf:captionLine 1/xf:caption
xf:violations class=error /
/xf:textbox
xf:textbox ref=/address2
xf:captionLine 2/xf:caption
xf:violations class=error /
/xf:textbox
xf:textbox ref=/address3
xf:captionLine 3/xf:caption
xf:violations class=error /
/xf:textbox
xf:textbox ref=/city
xf:captionCity/xf:caption
xf:violations class=error /
/xf:textbox
xf:textbox ref=/postCode
xf:captionPost Code/xf:caption
xf:violations class=error /
/xf:textbox
xf:textbox ref=/countryID
xf:captionCountry/xf:caption
xf:violations class=error /
/xf:textbox
xf:submit id=next class=button
xf:captionCreate My Account/xf:caption
xf:hintGo to next page/xf:hint
/xf:submit
/xf:form
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]