You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Rosario, Blossom" <Bl...@atosorigin.com> on 2005/04/13 10:28:51 UTC
[Struts Validator] JavaScript Validations
Hi,
I am trying to use client as well as server-side validations using the
Struts Validator.
The mapping in the Struts config file is
<action path="/register"
type="com.pampers.registration.action.RegisterAction"
name="registerForm"
scope="session"
validate="true"
input="/registration/reg_login.jsp"
parameter="method">
</action>
The corresponding reg_login.jsp page has the following lines to enable the
client-side validations for the login page:
<html:form action="/register.do?method=login" onsubmit="return
validateRegisterForm(this);">
and
<html:javascript formName="registerForm"/>
Now, when I submit the login page, the client-side validations are not
performed. When I do a view source, the dynamically generated
validateRegisterForm function has the following code in it:
<script type="text/javascript" language="Javascript1.1">
<!-- Begin
var bCancel = false;
function validateRegisterForm(form) {
if (bCancel)
return true;
else
return true;
}
//End -->
</script>
This is a snippet of validation.xml
<form name="registerForm">
<field property="userName" depends="required">
<arg0 key="label.email"/>
</field>
<field property="password" depends="required">
<arg0 key="label.password"/>
</field>
</form>
Would appreciate if somebody could throw light as to why the client side
validations are not being invoked.
Thanks and Regards,
Blossom
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org