thank you, the code of my form and javascript is below
Expand|Select|Wrap|Line Numbers
- <script language="javascript1.2">
- function validateForm(f)
- {
- event.returnValue = true;
- if (f.name.value == "")
- {
- alert("Sorry you must fill in the name field");
- event.returnValue = false;
- }
- z = document.forms['one'].contact.value;
- if ((f.contact.value == "") ||
- (isNaN(parseInt(z))) )
- {
- alert("Sorry you must enter a contact telephone number");
- event.returnValue = false;
- }
- if ((f.email.value.indexOf("@") == -1) ||
- (f.email.value.indexOf(".") == -1))
- {
- alert("Sorry the email field does not contain a valid email address");
- event.returnValue = false;
- }
- if (document.forms['one'].catagory.options[0].selected )
- {
- alert("you must choose a catagory");
- event.returnValue = false;
- }
- x = document.forms['one'].loan.value;
- if (isNaN(parseInt(x))) {
- alert("Please enter in a number into the loan field");
- event.returnValue = false;
- }
- }
- </script>
- <form action="mailto:SOMEEMAIL@SOMEEMAIL.com" method="post" enctype="multipart/form-data" id="one" onSubmit="validateForm(this)">
- <fieldset>
- <legend>Applicant</legend>
- <p>
- <label for="name"><span id="ast">*</span>Full name:</label>
- <input type="text" name="name" id="name"accesskey="n" tabindex="1"></p>
- <p>
- <label for="contact"><span id="ast">*</span>Contact Tel:</label>
- <input type="text" name="contact" id="contact" accesskey="c" tabindex="2">
- </p>
- <label for="email"><span id="ast">*</span>Email:</label>
- <input type="text" name="email" id="email" accesskey="e" tabindex="3">
- <br>
- </fieldset>
- <fieldset>
- <legend>Income Details</legend>
- <p>Employment type:</p>
- <label for="employ" style="width:8em; margin:0; text-align:left;" >Empolyed
- <input type="checkbox" name="employ" value="employed" id="employ" accesskey="m" tabindex="4">
- </label>
- <label for="self" style="width:8em; margin:0; text-align:left;" >Self employed
- <input type="checkbox" name="self" value="self-employed" id="self" accesskey="s" tabindex="5" >
- </label><br/><br/>
- <p><label for="sal">Salary:</label>
- <input type="text" name="sal" id="sal" accesskey="s" tabindex="6">
- </p>
- </fieldset>
- <fieldset>
- <legend>Mortage details</legend>
- <p>
- <label for="cat"><span id="ast">*</span>Catagory:</label>
- <select name="catagory" accesskey="v" tabindex="7" id="cat" >
- <option>Please Select</option>
- <option>Commercial</option>
- <option>First Time Buyer</option>
- <option>100% Mortgage</option>
- <option>Re-Mortgage</option>
- <option>Trading Up</option>
- <option>Investment</option>
- <option>Self Build</option>
- </select></p>
- <p>
- <label for="loan"><span id="ast">*</span>Loan amount:</label>
- <input type="text" name="loan" id="loan" accesskey="l" tabindex="8"></p>
- </fieldset>
- <input type="submit" name="Sub" id="sub" tabindex="9" value="Submit application" style="margin-top:10px;">
- <input name="clearpage" id="clearpage"type="reset" tabindex="10" value="Clear form" style="margin-top:10px;">
- </form>