Results 1 to 2 of 2
  1. #1
    June Homer
    Guest

    Form Validation with Netscape 6

    Can anyone tell me why the following code will work in IE5 but not Netscape 6! The submit button of my form has onClick=validateForm()

    function validateForm(){
    verify();
    }

    function verify() {
    alert("This is a test");
    }

    Any help greatly appreciated
    <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Form Validation with Netscape 6

    I first had to realize that I had turned off JavaScript in my browser (NS 4.7x)! Okay, fixed that.

    In your button, this should run the function:

    onClick="validateForm()"

    However, for maximum control, you might want to use the event handler in the FORM tag:

    <FORM onSubmit="return verify()">

    This way, if you don't want the form to submit, you can use "return false" in your event handler to prevent submission. Hope this helps.

Posting Permissions

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