Client Side Form Validation

Discussion in 'ASP .Net' started by =?Utf-8?B?Vmk=?=, Oct 11, 2004.

  1. I have a web form that is submitted using an <asp:Button> control.
    On this form I want to do some client side validation using the onsubmit
    event of the form (client side). In order to do that I'm trying to attach to
    the Form the onsubmit attribute, so that the client side code looks like this:
    <FORM NAME="oDoSubmit" onsubmit="return(myOnSubmitEventHandler());">
    </FORM>
    But I can't do that, because I don't know how to access the Form control in
    the code behind.
    Or maybe somebody has a better idea how to do client side validation on a
    web form that uses an <asp:Button> control to submit the form.

    Thank you
    Vi.
     
    =?Utf-8?B?Vmk=?=, Oct 11, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?Vmk=?=

    ESPN Lover Guest

    Add a custom validator then write your specific javascript function and
    attach that function to the custom validator and attach the control to the
    custom validator.

    See examples here: http://www.codeproject.com/aspnet/aspnetvalidation.asp


    "Vi" <> wrote in message
    news:...
    > I have a web form that is submitted using an <asp:Button> control.
    > On this form I want to do some client side validation using the onsubmit
    > event of the form (client side). In order to do that I'm trying to attach

    to
    > the Form the onsubmit attribute, so that the client side code looks like

    this:
    > <FORM NAME="oDoSubmit" onsubmit="return(myOnSubmitEventHandler());">
    > </FORM>
    > But I can't do that, because I don't know how to access the Form control

    in
    > the code behind.
    > Or maybe somebody has a better idea how to do client side validation on a
    > web form that uses an <asp:Button> control to submit the form.
    >
    > Thank you
    > Vi.
     
    ESPN Lover, Oct 11, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Libs
    Replies:
    0
    Views:
    1,498
  2. Matt
    Replies:
    14
    Views:
    4,106
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  3. =?Utf-8?B?dmlkeWE=?=
    Replies:
    1
    Views:
    754
    Kevin Spencer
    Jun 2, 2005
  4. Boss302
    Replies:
    0
    Views:
    1,053
    Boss302
    Nov 21, 2006
  5. Bogdan
    Replies:
    2
    Views:
    655
    Bogdan
    Jun 9, 2008
Loading...

Share This Page