Dave:
Thank you, here's the files:
ApplicationAction-validation.xml:
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator
1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="user.firstName">
<field-validator type="requiredstring" short-circuit="true">
<message>Please enter your first name.</message>
</field-validator>
<field-validator type="regex" short-circuit="true">
<param name="expression">^[a-z.\-, A-Z]+$</param>
<message>First Name may only contain letters, spaces or
periods</message>
</field-validator>
</field>
<field name="user.lastName">
<field-validator type="requiredstring" short-circuit="true">
<message>Please enter your last name.</message>
</field-validator>
<field-validator type="regex" short-circuit="true" >
<param name="expression">^[a-z.\-, A-Z]+$</param>
<message>Last Name may only contain letters, spaces or
periods</message>
</field-validator>
</field>
</validators>
jsp:
<s:form action="ApplicationSubmitAction.do" validate="true">
<s:textfield size="30" cssClass="inputtext" label="Email" name="user.email"
maxlength="100" />
<s:textfield size="30" cssClass="inputtext" label=" First Name"
name="user.firstName" required="true" requiredposition="left" maxlength="50"
/>
<s:textfield size="30" cssClass="inputtext" label=" Last Name"
name="user.lastName" required="true" requiredposition="left" maxlength="50"
/>
<s:textfield cssClass="inputtext" label=" Date of Birth (mm/dd/yyyy)"
name="user.dob" required="true" requiredposition="left" maxlength="10" />
<s:textfield size="30" cssClass="inputtext" label=" Address 1"
name="user.address1" required="true" requiredposition="left" maxlength="100"
/>
<s:textfield size="30" cssClass="inputtext" label="Address 2"
name="user.address2" maxlength="100" />
<s:textfield size="30" cssClass="inputtext" label=" City" name="user.city"
required="true" requiredposition="left" maxlength="100" />
<s:select cssClass="inputtext" label=" State" name="user.stateId"
list="#application.StatesInApplicationContext" listKey="state_id"
listValue="state" required="true" requiredposition="left" />
<s:textfield size="05" cssClass="inputtext" label=" ZIP Code"
name="user.zip" required="true" requiredposition="left" maxlength="5" />
<s:submit type="button" cssClass="btn" align="center" label="Submit my
application" value="%{'Submit'}" />
</s:form>
struts.xml action:
<constant name="struts.devMode" value="true" />
<package name="test-default" namespace="/applications"
extends="struts-default">
<action name="ApplicationSubmitAction.do"
class="test.action.ApplicationAction">
<result name="success" type="redirect">thanks.html</result>
<result name="input">/applications/application.jsp</result>
</action>
</package>
-----Original Message-----
From: Dave Newton [mailto:[EMAIL PROTECTED]
Sent: Friday, March 07, 2008 6:00 PM
To: Struts Users Mailing List
Subject: RE: short-circuit="true" not working in field validator
Please repost your configs, JSP, and action; I'll look at it again.
Dave
--- Chamara Gunaratne <[EMAIL PROTECTED]> wrote:
> Hmmm, I tried setting the log level to DEBUG and it yielded a mass of
> logging entries, but nothing that was particularly insightful. Grepping on
> short-circuit, validator, etc didn't bring out anything useful.
>
> Very strange problem, everything else seems to be working fine and I
cannot
> find anywhere I have deviated from the documentation ...
>
> Chamara
>
> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
> Sent: Wednesday, March 05, 2008 2:44 PM
> To: [email protected]
> Subject: Re: short-circuit="true" not working in field validator
>
> Chamara Gunaratne wrote:
> > Dave:
> > Thank you for your reply. I changed type attribute to "requiredstring".
> But
> > it doesn't help with the short-circuit problem.
> >
> > Yes, both the first name and last name validators fire successfully and
> the
> > regex is correctly evaluated. Just the short-circuit part is not
working.
>
> >
> > For example, if I submit a blank first name field, I get both error
> > messages: "Please enter your first name" and "First Name may only
contain
> > letters, spaces, dashes, or periods".
> > Cheers,
>
> AFAICT from the Validation documentation, it should be working as you
> expect. I would suggest turning logging up to DEBUG for Struts and/or
> XWork (probably XWork?) and see if you get anything that sheds light on
> what's going wrong.
>
> L.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]