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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to