Hi Matt,
In my validation.xml I have:
<form-validation>
...
<formset>
<form name="MyValidatorForm">
<field
property="field1"
depends="required">
<arg key="label.property1"/>
</field>
<!--
I�m always getting error in The 2 url fields bellow
-->
<field
property="urlfield1"
depends="required,url">
<arg key="label.urlfield1"/>
<var>
<var-name>allowallschemes</var-name>
<var-value>true</var-value>
</var>
</field>
<field
property="urlfield2"
depends="required,url">
<arg key="label.urlfield2"/>
</field>
<!--
The mask bellow works fine
-->
<field
property="positiveIntegerfield"
depends="required,mask">
<arg key="label.positiveIntegerfield"/>
<var>
<var-name>mask</var-name>
<var-value>^\d+$</var-value>
</var>
</field>
<!--
The field bellow won�t get any error with String value
-->
<field
property="doublefield"
depends="required,double">
<arg key="label.doublefield"/>
</field>
<!--
I tried some mask�s like this bellow
but it won�t get any error with a String value
-->
<field
property="doublefield2"
depends="required,mask">
<arg key="label.doublefield2"/>
<var>
<var-name>mask</var-name>
<var-value>\d{1,}\.\d{1,}</var-value>
</var>
</field>
</form>
</formset>
...
</form-validation>
And My ErrorValidation.jsp is :
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html>
<head>
<title><bean:message key="errors.cancel"/></title>
<html:base/>
</head>
<body bgcolor="white">
<bean:message key="errors.cancel"/>
<html:errors/>
</body>
</html:html>
-----Mensaje original-----
De: Matt Bathje [mailto:[EMAIL PROTECTED]
Enviado el: viernes, 07 de enero de 2005 16:29
Para: Struts Users Mailing List
Asunto: Re: Trouble validating
Miguel Atienza wrote:
> Hi!,
> I�m having trouble validating a standard form using de validation.xml
file.
> I defined one class,MyValidatorForm that extends ValidatorForm with the
> fields of the form
> and the getters and setters methods.
>
> In the validation.xml,when I use depends="required" for the fields I want,
> It works fine,
> And I get the messages fine
> With <html:errors/> in a jsp page : /pages/ErrorValidation.jsp
> but when I use depends="required,double" or depends="required,url"
> It does not work.
> If I send a String in the form field that is supposed to be double it
won�t
> get any error.
> I also have tried using some mask following the jakarta RegExp
> ,I tested then in http://jakarta.apache.org/regexp/applet.html.
> but only some mask�s works when I put them in the validation.xml.
>
> In the struts-config.xml I have:
>
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property
> property="pathnames"
> value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
> </plug-in>
>
> And in the action tag that uses this validation
> I have this attributes
>
> name="MyValidatorForm"
> validate="true"
> scope="request"
> input="/pages/ErrorValidation.jsp"
>
> Any help is appreciated.
> Miguel
>
Migule - we need to see what your validation.xml for the fields that
aren't working looks like. The relevant JSP (for the non-working fields)
may also help.
Matt
---------------------------------------------------------------------
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]