[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Validate multiple fields and show multiple messages
From:       <bjorn.de.bakker () accenture ! com>
Date:       2007-01-31 13:09:04
Message-ID: F2C7D413A9E110499A5A01094DF12F3101386853 () EMEXM0202 ! dir ! svc ! accenture ! com
[Download RAW message or body]


Rather annoying problem, but I really don't know how to fix it.

I have a form, with 3 fields on it.  A field for UserName, one for E-mailaddress and \
a checkbox.  The username can't be equal to a given value (let's say "testing") and \
if you check the checkbox, the e-mailaddress is required.  

If both checks fail, I want to display 2 error messages, one for the username and one \
for the e-mailaddress. 

When the username is equal to the given value, I add this: \
actionMessages.add(field.getKey(), Resources.getActionMessage(req, validatorAction, \
field));

When the checkbox is checked, and the e-mailaddress is empty: 
actionMessages.add(field.getKey(), Resources.getActionMessage(req, validatorAction, \
field)); actionMessages.add(EMAIL, Resources.getActionMessage(req, validatorAction, \
field)); where EMAIL is the key for the e-mailaddress field.

When a field fails the checksum, I put the text on the labels in red, like this: 
<span <logic:messagesPresent \
property="txtEmail">class="errorMsg"</logic:messagesPresent>>  <fmt:message \
key="createuser.email" bundle="${adminLabels}" /> </span>

The problem is, the error for the e-mailaddress is shown twice.  Is there a way to \
show the error once, but to put the labels both in red?  

Tia

Björn De Bakker



This message is for the designated recipient only and may contain privileged, \
proprietary, or otherwise private information.  If you have received it in error, \
please notify the sender immediately and delete the original.  Any other use of the \
email by you is prohibited.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic