Hi Ed,

Thank you for the clarification! That worked out great!

Priya

On 10/3/06, Ed Griebel <[EMAIL PROTECTED]> wrote:

Let me clarify, in your html:form statement, try adding a return like so:

<html:form action="/login" method="post" onsubmit="return
validateLoginForm(this)">

On 10/3/06, priya <[EMAIL PROTECTED]> wrote:
>
> Hi Ed,
>
> Thank you for your response!
> Since I am using Struts client side validation, I am not creating the
> validate method.. Struts is creating it for me..
> Do you mean I should create another method ? I am not sure if I can add
> return to the javascript which Struts creates for me?
>
> <%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
> <html:html>
> <HEAD></HEAD>
> <BODY>
> <html:errors/>
> <TABLE>
>     <html:form action="/login" method="post"
> onsubmit="validateLoginForm(this)">
>         <TR>
>             <TD>Username:</TD>
>             <TD><html:text property="userName" /></TD>
>         </TR>
>         <TR>
>             <TD>Password:</TD>
>             <TD><html:password property="password" /></TD>
>         <TR>
>             <TD>Submit</TD>
>             <TD><html:submit value="Login"
onclick="anotherValidateHere?()
> "/></TD>
>         </TR>
>     </html:form>
> <html:javascript formName="loginForm"/>
> </BODY>
> </html:html>
>
> Priya
>
> On 10/3/06, Ed Griebel <[EMAIL PROTECTED]> wrote:
>
> > In your form's onclick="validate()" method (or whatever it may be
> > called in your case), it may work to add "return" to the javascript
> > method call. The validate method will return false if validation
> > fails, and the form will not be submitted back to the server.
> >
> > HTH,
> > -ed
> >
> > On 10/3/06, priya <[EMAIL PROTECTED]> wrote:
> > > I am using client-side and server-side validation in my login form.
> > >
> > > Both work and when I dont enter the required fields I recieve a
> > javascript
> > > alert box saying that the fields "username or password are
required".
> > After
> > > I click okay it does a serverside validation as well and prints on
the
> >
> > > screen that the "username or password are required"..
> > >
> > > I was wondering if its possible to show "username or password are
> > required"
> > > only once. When there is javascript enabled on the browser, to show
> > the
> > > client side version only and when javascript is disabled use the
> > serverside
> > > version?
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>


Reply via email to