struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cheng Wei Lee" <zhenwei...@gmail.com>
Subject Re: Struts 2: duplicated error messages occur when nest another table within <s:form> tag
Date Thu, 10 Jan 2008 05:57:59 GMT
I read from the documentation that pure Javascript client side validation is
only applicable for xhtml and css_xhtml themes, so other themes are out. I
took a look at the validation.js and found that the Javascript function to
clear the error messages actually only consider that there're 1 table in the
entire HTML document. So perhaps I would change this code and see if it
works.

On Jan 10, 2008 7:24 AM, Laurie Harper <laurie@holoweb.net> wrote:

> Cheng Wei Lee wrote:
> > I'd difficulties in clearing the client side validation error messages.
> So I
> > followed the guide at
> > http://struts.apache.org/2.x/docs/client-validation.html and try from
> > scratch and found that if I nest a table within the <s:form> tag, the
> > message cannot be cleared and it will keep accumulating. Below is my
> > modified JSP. If I cannot add nested tables, it will limit my design of
> the
> > page severely. Does anyone has a workaround?
> >
> > <%@ page language="java" contentType="text/html; charset=UTF-8"
> >     pageEncoding="UTF-8"%>
> > <%@ taglib prefix="s" uri="/struts-tags"%>
> >
> > <html>
> > <head>
> > <title>Client Side Validation</title>
> > <s:head />
> > </head>
> > <body>
> >
> > <s:form method="post" validate="true" action="quizClient"
> > namespace="/validation">
> >     <table width="800" border="0" align="center" cellpadding="0"
> >         cellspacing="0" bgcolor="#FFFFFF" class="wwFormTable">
> >         <s:textfield label="Name" name="name"/>
> >         <s:textfield label="Age" name="age"/>
> >         <s:textfield label="Favorite color" name="answer"/>
> >         <s:submit/>
> >     </table>
> > </s:form>
> >
> > </body>
> > </html>
>
> Take a look at the resulting HTML that is generated; the s:form tag
> generates a table, so the table you include in your markup causes the
> resulting HTML to be invalid.
>
> Rather than in-lining an extra table, use CSS to apply the styling you
> want to the table Struts generates. Alternatively, you could try using a
> different theme for the s:form tag (e.g. theme="simple"). See here for
> more info:
>
> http://struts.apache.org/2.x/docs/themes-and-templates.html
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message