if i get rid of the class on the submit button (ValidateForm)
it works but obviously doesn't do the error checking...
Expand|Select|Wrap|Line Numbers
- <form id="contactForm" class="paypal" action="paypal/payments.php" method="post">
- <input class="text" name="ContactFormTitle" id="ContactFormTitle" value="" maxlength="32" size="32" type="text">
- <div id="errTitle" style="display: none;">Please enter the Title</div>
- <tr id="errFirstName" style="display: none;">
- <div>Please enter your correct First Name</div>
- <td class="maincontent">First name *</td>
- <input class="text" name="ContactFormFirstName" id="ContactFormFirstName" value="" maxlength="256" size="50" validate="populated" type="text">
- <tr id="errLastName" style="display: none;">
- <div>Please enter your correct Last name</div>
- <td class="maincontent"> </td>
- <td class="maincontent">Last name *</td>
- <input class="text" name="ContactFormLastName" id="ContactFormLastName" value="" maxlength="256" size="50" validate="populated" type="text">
- <tr id="errHouseNumber" style="display: none;">
- <td> <div>Please enter the House number</div> </td>
- <td class="maincontent"> </td>
- <td class="maincontent">House number *</td>
- <input class="text" name="ContactFormHouseNumber" id="ContactFormHouseNumber" value="" maxlength="64" size="10" validate="populated" type="text">
- <input name="cmd" type="hidden" value="_xclick" />
- <input name="no_note" type="hidden" value="1" />
- <input name="lc" type="hidden" value="UK" />
- <input type="hidden" name="no_shipping" value="0">
- <input name="currency_code" type="hidden" value="GBP" />
- <input type="submit"
- class="ValadateForm"
- value="Continue" />
- </form>
Expand|Select|Wrap|Line Numbers
- $(function() {
- $(".ValadateFormAndUploadDetailsToDatabase").click(function(e){
- e.preventDefault();
- // validate and process form here
- $('#errFirstName').hide();
- var FirstName = $("input#ContactFormFirstName").val();
- var FirstNameLength = FirstName.length;
- if ( (FirstNameLength <= 2) || ( FirstNameLength > 40 ) ) {
- $("#errFirstName").show();
- $("input#ContactFormFirstName").focus();
- return false;
- }
- $('#errLastName').hide();
- var LastName = $("input#ContactFormLastName").val();
- var LastNameLength = LastName.length;
- if ( (LastNameLength <= 2) || ( LastNameLength > 40 ) ) {
- $("#errLastName").show();
- $("input#ContactFormLastName").focus();
- return false;
- }
- $('#errHouseNumber').hide();
- var HouseNumber = $("input#ContactFormHouseNumber").val();
- if ( (HouseNumber == "") || ( HouseNumber == 0 ) ) {
- $("#errHouseNumber").show();
- $("input#ContactFormHouseNumber").focus();
- return false;
- }
- $('#errPostcode').hide();
- var Postcode = $("input#ContactFormPostcode").val();
- var PostcodeLength = Postcode.length;
- if ( (PostcodeLength > 8) || (PostcodeLength <= 5) ) {
- $("#errPostcode").show();
- $("input#ContactFormPostcode").focus();
- return false;
- }
- $('#errEmail').hide();
- $('#errConfirmEmail').hide();
- $('#errEmailMatch').hide();
- var Email = $("input#ContactFormEmail").val();
- var EmailLength = Email.length;
- var ConfirmEmail = $("input#ContactFormConfirmEmail").val();
- var ConfirmEmailLength = ConfirmEmail.length;
- if ( (EmailLength < 5 ) || (EmailLength > 40 ) ) {
- $("#errEmail").show();
- $("input#ContactFormEmail").focus();
- return false;
- }
- if ( (ConfirmEmailLength < 5 ) || ( ConfirmEmailLength > 40 ) ) {
- $("#errConfirmEmail").show();
- $("input#ContactFormConfirmEmail").focus();
- return false;
- }
- if ( (Email != ConfirmEmail ) ) {
- $("#errEmailMatch").show();
- $("input#ContactFormEmail").focus();
- return false;
- }
- });
- });