struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject Re: [S2] fieldError - highlight input field using "simple" theme?
Date Thu, 24 Jan 2008 14:21:03 GMT
            <s:if test="getFieldErrors().get('name') != null">

I'd probably urge you to modify an existing template or create your own,
though.

d.

--- Rubens <rubens_gomes@hotmail.com> wrote:

> 
> I have a form with multiple input fields, and I am using the "simple"
> theme. 
> Is it possible to determine (maybe using <s:if..>) when a given field fails
> validation? I already tried hasFieldErrors(); however, hasFieldErrors()
> does
> not allow me to distinguish which field on the form fails.
> 
> Here is what I want:
> 
>   <s:form method="POST" action="login_doLogin" validate="true"
> cssClass="homeLoginForm">
>     <fieldset>
>       <s:actionerror />
> 
>       <label for="loginId">
>         <s:text name="label.loginId" />
>       </label>
>       <s:if test="<field loginId is okay -- what do I put here???">
>         <s:textfield required="true" id="loginId" name="loginId" size="25"
> maxlength="100"  />
>      </s:if>
>      <s:else>
>        <s:textfield required="true" id="loginId" name="loginId" size="25"
> maxlength="100"  cssClass="error"  />
>      </s:else>
>      <s:fielderror name="loginId" >
>         <s:param>loginId</s:param>
>       </s:fielderror>
> 
>       <label for="password">
>         <s:text name="label.password" />
>       </label>
>       <s:if test="<field password is okay -- what do I put here???">
>         <s:password required="true" id="password" name="password" size="25"
> maxlength="10" showPassword="true" />
>       </s:if>
>       <s:else>
>         <s:password required="true" id="password" name="password" size="25"
> maxlength="10" showPassword="true" cssClass="error" />
>       </s:else>
>       <s:fielderror>
>         <s:param>password</s:param>
>       </s:fielderror>
> 
>       <s:submit key="button.signIn" type="submit" />
> 
>     </fieldset>
>   </s:form>
> 
> -- 
> View this message in context:
>
http://www.nabble.com/-S2--fieldError---highlight-input-field-using-%22simple%22-theme--tp15060201p15060201.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message