hi,
i have a login form and i need to validate all the fields are required
as well as the email is a valid email. when i use the following code on
top it prints out the required error messages for all the fields but i
want it to print it out only once.
<logic:messagesPresent>
<div class="errorblock">
<html:errors />
</div>
</logic:messagesPresent>
i can do this by commenting out the <html:errors /> but then my global
error for email/user does not exist does not display.
please tell me how i can work around this. i am new to it and need to
get this working asap. apreciate any help.
thanks.
Tim B - 12 Dec 2005 04:32 GMT
> hi,
> i have a login form and i need to validate all the fields are required
[quoted text clipped - 14 lines]
>
> thanks.
I'm not sure exactly what you want, but I'm guessing you want to show only a
specific error message. It can be done like this:
<logic:messagesPresent>
<html:messages id="theError" property="myErrorName">
<bean:write name="theError"/>
</html:messages>
</logic:messagesPresent>
"myErrorName" is the name you save the error with, in your validation code
Hiran Chaudhuri - 12 Dec 2005 22:57 GMT
> i have a login form and i need to validate all the fields are required
> as well as the email is a valid email. when i use the following code on
> top it prints out the required error messages for all the fields but i
> want it to print it out only once.
I'm not sure what you want. Do you want to see the messages generated by the
validation (i.e. the error messages) or do you not want to see them?
Taking a guess, your problem with email validation should be on the
validation side, which means either the validation framework (configured
with the struts xml configuration) or the action that validates before
calling the business logic. What you mention is just how the messages are
displayed.
Well then, that is what your subject line also says.....
Hiran