form submit question

Discussion in 'ASP General' started by Matt, May 3, 2004.

  1. Matt

    Matt Guest

    When the user click the submit button in myform.asp, then it will invoke the
    javascript to check the form data. I want to know if we need
    document.myform.submit(); ?? Because even I comment it out, formresponse.asp
    could still get the form data.

    //myform.asp
    <html>
    <head><title></title>
    <script language="javascript">
    function checkformdata()
    {
    //etc...
    document.myform.submit();
    }
    </script>
    </head>
    <body>
    <form action="formrespsonse.asp" name="myform" method="post"
    onsubmit="checkformdata()">
    //etc...
    <P><input type="submit"><input type="reset">
    </form>
    </body>
    </html>

    //formresponse.asp
    <%= Request.Form %>
    Matt, May 3, 2004
    #1
    1. Advertising

  2. Matt

    Ray at Guest

    This is not an ASP question. This is a client-side scripting question, but
    to answer your question, no, you don't need that .submit() stuff. Client
    side validation is typically handled as such:

    <form onsubmit="return yourFunction();">

    <script type="text/javascript">
    function yourFunction() {
    if(your condition here) {
    return true;
    }
    else {
    return false;
    }
    }
    </script>

    Ray at home

    "Matt" <> wrote in message
    news:...
    > When the user click the submit button in myform.asp, then it will invoke

    the
    > javascript to check the form data. I want to know if we need
    > document.myform.submit(); ?? Because even I comment it out,

    formresponse.asp
    > could still get the form data.
    >
    > //myform.asp
    > <html>
    > <head><title></title>
    > <script language="javascript">
    > function checkformdata()
    > {
    > //etc...
    > document.myform.submit();
    > }
    > </script>
    > </head>
    > <body>
    > <form action="formrespsonse.asp" name="myform" method="post"
    > onsubmit="checkformdata()">
    > //etc...
    > <P><input type="submit"><input type="reset">
    > </form>
    > </body>
    > </html>
    >
    > //formresponse.asp
    > <%= Request.Form %>
    >
    >
    Ray at, May 3, 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.

Share This Page