Results 1 to 4 of 4

Thread: cancelling a submit

  1. #1

    Thread Starter
    Hyperactive Member richy's Avatar
    Join Date
    Jan 1999
    Location
    Liverpool, England
    Posts
    353
    I'm trying to stop my form from submitting when I press enter on a text box, but I can't find out how to do it.
    I've tried doing document.selectform.submit=false;, but this doesn't work.

  2. #2
    Member
    Join Date
    Aug 1999
    Location
    metairie, la usa
    Posts
    40

    Stopping post on enter.

    Hi,
    Leave the submit button out of the form. Make a regular button with onclick event to submit the form.
    <form name="test" method="post" index="test.html">
    <input type="text" name="blah" >
    <input type="button" value="Submit" onclick="document.test.submit();">
    </form>

    by changing the submit button to a regular button, enter will no longer submit the form.
    Let me know if this helps.
    Last edited by winapi; Feb 27th, 2001 at 12:44 AM.

  3. #3

    Thread Starter
    Hyperactive Member richy's Avatar
    Join Date
    Jan 1999
    Location
    Liverpool, England
    Posts
    353
    I'm afraid that can't be the problem, because I don't actually have a submit button on my form. The only button I have is set up as the following:

    <input type=button value='Find' onClick='promptSearch()' name=btnfind>

    Just incase it interests anybody, I have the following in my form header:

    <form name=selectform action=results2.asp>

    Any more ideas?

  4. #4

    Thread Starter
    Hyperactive Member richy's Avatar
    Join Date
    Jan 1999
    Location
    Liverpool, England
    Posts
    353
    By looking at the following tip:
    http://webreference.com/js/tips/000501.html

    This seems to be the fix of my problem. My only niggle is that I don't know how to set it up, as I have an action setting for my form rather than an onSubmit. Does anybody know, but looking at my first post as well, how I can set this whole thing up?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width