473,394 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

why doesn't my jquery work on my paypal button ?

i have a form that should be posted to a payments page, it worked fine untill i desided to add some error checking to it using jquery...

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
  1. <form id="contactForm" class="paypal" action="paypal/payments.php" method="post">
  2.                                                                                                                  <input class="text" name="ContactFormTitle" id="ContactFormTitle" value="" maxlength="32" size="32" type="text">
  3.  
  4.                                                          <div id="errTitle" style="display: none;">Please enter the Title</div>
  5.                                                          <tr id="errFirstName" style="display: none;">
  6. <div>Please enter your correct First Name</div>
  7.                                                          <td class="maincontent">First name *</td>
  8.                                                          <input class="text" name="ContactFormFirstName" id="ContactFormFirstName" value="" maxlength="256" size="50" validate="populated" type="text">
  9.                                                          <tr id="errLastName" style="display: none;">
  10.                                                          <div>Please enter your correct Last name</div>
  11.                                                          <td class="maincontent">&nbsp;&nbsp;</td>   
  12.                                                          <td class="maincontent">Last name *</td>
  13.                                                          <input class="text" name="ContactFormLastName" id="ContactFormLastName" value="" maxlength="256" size="50" validate="populated" type="text">
  14.  
  15. <tr id="errHouseNumber" style="display: none;">
  16.                                                          <td> <div>Please enter the House number</div> </td>
  17.  
  18. <td class="maincontent">&nbsp;&nbsp;</td>   
  19.                                                          <td class="maincontent">House number *</td>
  20.                                                          <input class="text" name="ContactFormHouseNumber" id="ContactFormHouseNumber" value="" maxlength="64" size="10" validate="populated" type="text">
  21.  
  22.  
  23.  
  24.                                                          <input name="cmd" type="hidden" value="_xclick" />
  25. <input name="no_note" type="hidden" value="1" />
  26. <input name="lc" type="hidden" value="UK" />
  27. <input type="hidden" name="no_shipping" value="0">
  28. <input name="currency_code" type="hidden" value="GBP" />
  29.  
  30. <input type="submit" 
  31.  
  32. class="ValadateForm" 
  33.  
  34. value="Continue" />
  35.                                                                                                                   </form>
  36.  
  37.  
jquery...

Expand|Select|Wrap|Line Numbers
  1. $(function() { 
  2.  
  3.    $(".ValadateFormAndUploadDetailsToDatabase").click(function(e){
  4.         e.preventDefault();
  5.  
  6.    // validate and process form here
  7.  
  8.    $('#errFirstName').hide();          
  9.  
  10.        var FirstName = $("input#ContactFormFirstName").val();  
  11.        var FirstNameLength = FirstName.length;
  12.  
  13.         if ( (FirstNameLength <= 2) || ( FirstNameLength > 40 ) ) { 
  14.  
  15.         $("#errFirstName").show();  
  16.  
  17.         $("input#ContactFormFirstName").focus();  
  18.  
  19.        return false;
  20.      }
  21.  
  22.      $('#errLastName').hide();          
  23.  
  24.        var LastName = $("input#ContactFormLastName").val();  
  25.        var LastNameLength = LastName.length;
  26.  
  27.         if ( (LastNameLength <= 2) || ( LastNameLength > 40 ) ) { 
  28.  
  29.         $("#errLastName").show();  
  30.  
  31.         $("input#ContactFormLastName").focus();  
  32.  
  33.        return false;
  34.      }
  35.  
  36.      $('#errHouseNumber').hide();          
  37.  
  38.        var HouseNumber = $("input#ContactFormHouseNumber").val();  
  39.  
  40.         if ( (HouseNumber == "") || ( HouseNumber == 0 ) ) { 
  41.  
  42.         $("#errHouseNumber").show();  
  43.  
  44.         $("input#ContactFormHouseNumber").focus();  
  45.  
  46.         return false;
  47.      }
  48.  
  49.      $('#errPostcode').hide();          
  50.  
  51.        var Postcode = $("input#ContactFormPostcode").val();  
  52.        var PostcodeLength = Postcode.length;
  53.  
  54.         if ( (PostcodeLength > 8) || (PostcodeLength <= 5) ) { 
  55.  
  56.         $("#errPostcode").show();  
  57.  
  58.         $("input#ContactFormPostcode").focus();  
  59.  
  60.        return false;
  61.      }
  62.  
  63.      $('#errEmail').hide();
  64.      $('#errConfirmEmail').hide();
  65.      $('#errEmailMatch').hide();       
  66.  
  67.        var Email = $("input#ContactFormEmail").val();
  68.        var EmailLength = Email.length;
  69.  
  70.        var ConfirmEmail = $("input#ContactFormConfirmEmail").val();
  71.        var ConfirmEmailLength = ConfirmEmail.length; 
  72.  
  73.         if ( (EmailLength < 5 ) || (EmailLength > 40 ) ) { 
  74.  
  75.         $("#errEmail").show(); 
  76.  
  77.         $("input#ContactFormEmail").focus();  
  78.  
  79.       return false;  
  80.         }
  81.  
  82.         if ( (ConfirmEmailLength < 5 ) || ( ConfirmEmailLength > 40 ) ) { 
  83.  
  84.         $("#errConfirmEmail").show(); 
  85.  
  86.         $("input#ContactFormConfirmEmail").focus();  
  87.  
  88.        return false;    
  89.      }
  90.  
  91.      if ( (Email != ConfirmEmail ) ) { 
  92.  
  93.         $("#errEmailMatch").show(); 
  94.  
  95.         $("input#ContactFormEmail").focus();  
  96.  
  97.        return false;   
  98.      }
  99.  
  100.  
  101.  
  102.    });                
  103.  
  104. });
  105.  
  106.  
Aug 18 '11 #1
2 2077
I think i might be something to do with e.preventDefault(); but not sure i'v check it out but cant find much, please help :)
Aug 19 '11 #2
can any one help me please,
Aug 22 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Iver Erling Årva | last post by:
Can anyone please tell me why this doesn't work? The sign changes when I hit the button, and I get no error messages, but the textarea doesn't disappear/reappear. <html> <head> <title>New...
10
by: Brett | last post by:
This code is supposed to work in Netscape 4+ and IE 4+. It works fine in IE but in Netscape 7.2, I get a blank page. Any suggestions? Thanks, Brett <html> <head>
0
by: Colleyville Alan | last post by:
I have an app that looks up an id number and when a button is clicked, inputs the id # into a query. After running the query, I click a second button which grabs the client name rather than the id...
1
by: A Ratcliffe | last post by:
Should be simple, but... Wanted to put some nice bitmaps on my First/Previous/Next/Last buttons, so I created four 16-colour bitmaps (as a test), used the traditional magenta colour for the...
3
by: MeNotHome | last post by:
I am trying to automate web browser navigation and form fill out in vb.net Why doesn't this work? AxWebBrowser1.Document.Forms(0).All("action-download").click() I also tried...
0
by: jonefer | last post by:
Private Sub txtLastName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLastName.TextChanged If Me.cmdAction.Text = "Update" Then Me.cmdAction.Enabled = True...
3
by: Joey | last post by:
I am working on an asp.net 1.1 web app in C#. I downloaded some sample code that is supposed to allow for me to persist session state. The code is as follows: private void PersistSessionState()...
7
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/xml.html The first alert() shows the XML that the server is returning. The second alert() shows a particular elements nodeValue and, as you can see,...
3
by: drzoo2 | last post by:
Completely noob question as I am not a programmer but really trying hard to learn Python (Object oriented programming in general). I am writing a program in python that calls a popup window with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.