Hi Friends,
I am also trying to validate my login form in struts using Validator form.
I made my form class extend the ValidatorForm class,and wrote all the validation components,and
its validating but
no pop-up box is coming up.
And I have disabled my pop-up blocked too.Here's are my parts:
validation.xml:
code:
--------------------------------------------------------------------------------
<formset>
<!-- An example form -->
<form name="LoginForm">
<field property="username" depends="required">
<arg key="tlms.logonForm.username" />
</field>
<field property="password" depends="required,mask">
<arg key="tlms.logonForm.password" />
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
</form>
</formset>
--------------------------------------------------------------------------------
Struts-config.xml:
code:
--------------------------------------------------------------------------------
<action-mappings>
<action path = "/LoginAction"
type = "com.hsc.tlms.action.LoginAction"
name = "LoginForm"
scope = "request"
validate="true"
input = "/JSP/Login.jsp"
>
<forward name="LoginSuccess" path="/HomeAction.do" />
</action>
</action-mappings>
.... .... ....
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
--------------------------------------------------------------------------------
LoginForm class:
code:
--------------------------------------------------------------------------------
public class LoginForm extends ValidatorForm{ // getters and setters}
--------------------------------------------------------------------------------
Login.jsp
code:
--------------------------------------------------------------------------------
<html:form action="LoginAction.do" focus="userId" onsubmit="return validateLoginForm(this)"><table>
<tr> ... ... ... </tr>
</table>
<html:submit property="submit" value="Submit" />
</html:form>
</body>
</html:html>
And <html:javascript formName="LoginForm" /> in the <head> of the
jsp page.
Please help