form validation help

Results 1 to 2 of 2

Thread: form validation help

  1. #1
    Join Date
    Dec 1969

    Default form validation help

    I have a form with two text boxes. How can I validate the form so that <BR>Box1 &#060; box2 <BR>to submit.<BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: form validation help

    In the &#060;form&#062; tag, add: onsubmit="return validate(this);"<BR><BR>Now add a &#060;script language="javascript"&#062; block in the &#060;head&#062; section of your page, and insert the following function:<BR><BR>function validate(frm) {<BR><BR> if (frm.Box1.value &#060; frm.Box2.value) {<BR> return true;<BR> }<BR> else {<BR> alert ("Box 1 must be less than Box 2");<BR> return false;<BR> }<BR><BR>}<BR><BR>All untested. You&#039;ll also want to add code to the validate() function to make sure that Box1 and Box2 contain numbers before doing the comparison. Hopefully this is enough to get you started in the right direction.<BR><BR>Mike

Posting Permissions

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