struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kawczynski, David" <david_kawczyn...@merck.com>
Subject RE: [S2] client-side validation error message duplication
Date Fri, 12 Sep 2008 15:05:56 GMT
--- On Fri, 9/12/08, Kawczynski, David wrote:
> I'm using struts 2.1.2, and the xhtml theme to render a
> form. When client-side validaiton fails, an error message
> is placed above the bad input fields.
> Subsequent submission attempts result in new error messages
> being ADDED to the UI, but the old messages are never removed.

I found the issue.  I was being a dodo.

The struts/xhtml/validation.js file's clearErrorMessages function
contains code to retrieve the table that stores the form.  It then
iterates over the table's rows, deleting any that has an "errorFor"
attribute.  In my case, the table that is retrieved is completely empty!
It turns out that my jsp file looks like this:

<s:form action="save">
	<table>
		<s:textfield blah blah blah/>
	</table>
</s:form>

Which resulted in the generated html to look like this:
<s:form action="save">
	<table class="wwFormTable">
		<table>
			<tr>
				<td blah blah blah</td>
			</tr>
		</table>
	</table>
</s:form>

The first table in the form had no rows!  Removing the empty <table>
elements from the jsp page fixed my issue.  I should pay more attention
when migrating from the simple theme to an xhtml theme.  :)

Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or
MSD and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html) that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and
then delete it from your system.


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


Mime
View raw message