Results 1 to 2 of 2

Thread: Form

  1. #1
    Join Date
    Oct 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Form

    I have a form and im using javascript to make fields all be filled otherwise no send (but i want to make the email field optional donno how)
    heres my script (i've excluded my JavaScript i will add if anyone can tell how to make my Email field not required.):
    <html>

    <head>

    <title>My Domain Contact Us Form</title>
    </head>

    <center><h2> Contact us </h2></center>
    <FORM ACTION="http://www.my-domain-site.com" METHOD ="POST">
    <p>
    Name:<INPUT TYPE="text" name="first" size="20">
    </p>
    <p>
    Email:
    <INPUT TYPE="text" name="middle" size="20">
    </P>
    <p>
    Contact Reason:
    <INPUT TYPE="text" name="last" size="20">
    </p>
    <p>
    Please enter text in field below:<br>
    <TEXTAREA NAME="Answer" Rows="5" COLS="20" WRAP>
    </TEXTAREA>
    </P>
    <INPUT TYPE="Submit" Value="Submit Form">
    <INPUT TYPE="Reset" Value= "Clear Form">
    </center>
    </FORM>
    </body>

    </html>

  2. #2
    Join Date
    Sep 2004
    Location
    Little Falls, Roodepoort, South Africa
    Posts
    421
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    Like this.....

    <script>
    function Area_empty() {
    var empty = true
    for (var i=0;i<frMain.elements['Area[]'].length;i++) {
    if (frMain.elements['Area[]'][i].checked) {
    empty = false;
    }
    }
    return empty;
    }

    function form_go() {
    if (frMain.Name.value == '') {
    alert('Please enter your Name');
    return false;
    } else if ((frMain.Email.value == '') && (frMain.Tel.value == '') ) {
    alert('Please enter yout telephone number or email address')
    return false;
    } else if (Area_empty()) {
    alert('Please select an Area');
    return false;
    } else {
    return true;
    }
    }
    </script>
    Very Best Rgds, Simonf :cool:
    __________________________________
    My Site | E-Mail Me

Bookmarks

Posting Permissions

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