struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dimitris Mouchritsas <dimitris.mouchrit...@eurodyn.com>
Subject Javascript validation error
Date Tue, 15 Jul 2008 15:02:15 GMT
Hi all,
I'm trying to use javascript validation with validator, as well as 
server side validation.
Server side validation works just great. But when I try to use client 
side validation I
get a validateRequired not found error.

This is my jsp:
....
    <html:javascript formName="LoginForm" />
    <html:form action="/login" onsubmit="return validateLoginForm(this)">
....
and this is the result produced from the tags:

.....

        <script type="text/javascript"> 
//<![CDATA[

    var bCancel = false; 

    function validateLoginForm(form) { 
        if (bCancel) { 
            return true; 
        } else { 
            var formValidationResult; 
            formValidationResult = validateRequired(form); 
            return (formValidationResult == 1); 
        } 
    } 

    function LoginForm_required () { 
     this.a0 = new Array("username", "Username is required.", new Function ("varName", " return
this[varName];"));
     this.a1 = new Array("password", "Password is required.", new Function ("varName", " return
this[varName];"));
    } 


//]]>
</script>

<form id="LoginForm" method="post" action="/ceproc/login.do" onsubmit="return validateLoginForm(this)">

.......
Now I understand why the error happens, but where do I locate this 
validateRequired function? How do I include it in my jsp?
Thanks
Dimitris


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message