Form Validation

Results 1 to 2 of 2

Thread: Form Validation

  1. #1
    Join Date
    Dec 1969

    Default Form Validation

    I have a form with an input I need to validate, but I don&#039;t know how to do it.<BR><BR>The data in the input has to be entered as an integer (ie 7, not seven.) What I have right now is a javascript function which takes the value entered in the input, and subtracts it from itself. If the result is not zero, it throws up an alert message. The function is called on by the onBlur() method.<BR><BR>This works well, with one exception. If the user fills out the form, then presses enter instead of clicking the submit button, the alert appears, but the form still gets submitted.<BR><BR>I&#039;m an ASP novice, so I need this to be simple, but is there a way to do some client side validation as I described, to make sure that a value in the form is a number?

  2. #2
    Join Date
    Dec 1969

    Default RE: Form Validation

    so don&#039;t call it onblur. call it like this<BR><BR><BR>&#060;form onsubmit="return doValidation()"&#062;<BR><BR>and return false if it&#039;s invalid.

Posting Permissions

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