SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pleasee help me-form validation and redirecting query

    I am having problems with my form.
    It was validating fine but now i have made the form go to another webpage, it just redirects straight to that and doesnt bother validating. Please help me i have been trying everything.
    Iv attached the files below, i would really appreciate it anyone could just tell me where im going wrong

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2006
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't see any files... but it I would guess that when your code runs there's an error and it just continues to submit the form. Run it in FireFox and check the JS error console.

  3. #3
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sorry, here is the code

    Both javascript and xhtml are in different files
    Thats the form----
    <table id="form">
    <legend>Contact Us</legend>
    <form action="http://quanglewangle.com/formEngine/formEngine.php" name="form" method="get" onSubmit="return validate_email();">

    <fieldset>

    <input type="hidden" name="FORM_INSTANCE_ID" value="Kellyc0415">
    Name:
    <input type="text" name="name"onchange="isReady_name()">
    </p>
    <label for="email">Email/label>
    <input type="text" name="email" onchange="validate_email()"/>
    </p>
    <p>
    <label for="telephone">Telephone Number/label>
    <input type="text"name="number" onchange="isReady_number()"/>
    <p>
    <label for="ref">Reference Number(if booking)/label>
    <input type="text"name="ref" />
    <p></p>
    <label for="rate">How did you find this site?<br> At Spanish Setting we feel it is important for you as the customer to be satisfied with out service<br>in order to make sure our website is of good standard, please leave your rating</label>
    </p>
    <p>
    <input type="radio" name="websiterating" id="Easy to use" value="Easy" checked="checked"/>
    <label for="Easy to use">Easy to Use</label><br>
    <input type="radio" name="websiterating" id="Average Website" value="Average" checked="checked"/>
    <label for="Average Website">Average Website</label><br>
    <input type="radio" name="websiterating" id="Complicated" value="Complicated" checked="checked"/>
    <label for="Complicated">Complicated</label>
    </p>
    <p>
    <label for="reason">Contacting Reason?</label>
    <select name="Reason" id="Reason">
    <option selected="selected">Book</option>
    <option>Query </option>
    <option>Website Fault </option>
    <option>Comment </option>
    <option>Complaint </option>
    <option>Specific Villa Query (Please state Villa ID no.) </option>

    </select>
    </p>
    <label for="comments">Type Here</label></p>
    <p><textarea name="comments" rows="5" cols="40"></textarea></p>
    <p>

    <input type="submit" value="Submit Data"/></p>
    <input type="hidden" name="redirect" value="http://www.freewebs.com/kelly3330/book.htm">
    </fieldset>

    </form>

    ---this is the javascript
    function validate_email(e) {
    if ((e.value.indexOf('@')==-1) || (e.value.indexOf('.')==-1)){
    alert('Invalid Email');
    e.focus();
    return false;
    }else{return true}
    }


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
  •