Stop form from submiting

Results 1 to 3 of 3

Thread: Stop form from submiting

  1. #1
    Join Date
    Dec 1969

    Default Stop form from submiting

    Currently if the user hits the enter button after typing in there password the form submits. I need to user to click on the submit button. How do I force the user to click on a submit button.

  2. #2
    Join Date
    Dec 1969

    Default RE: Stop form from submiting

    the form will submit when pressing &#060;enter&#062; regardless of whether or not a password is entered, as it is the default event for the document.<BR><BR>developers commonly code a javascript event that fires onClick, and in that script the form&#039;s controls are checked to ascertain if their contents are within required parameters. if they are then the function returns true, if not then it returns false.<BR><BR>this passes control of form submission to the script before the form is actually submitted. in your button control attributes, include the property onclick="return fnSubmit()" where fnSubmit() is your javascript function that validates the form&#039;s data.

  3. #3
    Join Date
    Dec 1969

    Default Change the keycode to a tab key

    Call this in the onKeyDown event of your form element.<BR><BR>&#060;input type=text name=blah onKeyDown=&#039;return PreventKeys(event);&#039;&#062;<BR><BR><BR><BR>fun ction PreventKeys(e)<BR>{<BR><BR> var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;<BR> <BR> switch (key)<BR> {<BR> case 13:<BR> e.keyCode = 9;<BR> break;<BR> }<BR> return true;<BR>}<BR>

Posting Permissions

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