You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by st...@teamics.com on 2002/12/06 20:52:48 UTC
Validation JavaScript function name mismatch
What would cause validation JavaScript to be generated with the wrong
function name?
See validateLogonForm, below. It calls validateRequired(form); however,
the actual function name is "required()". I had the same problem with
minimum and maximum length on another form The main function called
validateMinLength(), but the actual name was minLength()..
<SCRIPT LANGUAGE="Javascript1.1">
<!-- Begin
var bCancel = false;
function validateLogonForm(form) {
if (bCancel)
return true;
else
return validateRequired(form);
}
function required () {
this.aa = new Array("loginId", "", new Function ("varName", " return
this[varName];"));
this.ab = new Array("password", "", new Function ("varName", " return
this[varName];"));
}
// End -->
</SCRIPT>
**************** snippet from Struts-config
***********************************
form-bean name="logonForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="loginId" type="java.lang.String" />
<form-property name="password" type="java.lang.String" />
</form-bean>
<!-- Process a user logon -->
<action path="/logon" type="com.patriot.view.LogonAction" name="logonForm" scope="session" input="logon" validate="true">
<exception key="expired.password" type="com.patriot.view.ExpiredPasswordException" path="change.password.page" />
</action>
*********** snippet from validate.xml *********************************
<form name="logonForm">
<field property="loginId"
depends="required">
<arg0 key="prompt.loginid"/>
</field>
<field property="password"
depends="required">
<arg0 key="prompt.password"/>
</field>
</form>