Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/webitects2nd.js |
— | — | @@ -0,0 +1,91 @@ |
| 2 | +/* |
| 3 | + * The following variable are declared inline in webitects_2_3step.html: |
| 4 | + * amountErrors, billingErrors, paymentErrors, scriptPath, actionURL |
| 5 | + */ |
| 6 | +$( document ).ready( function () { |
| 7 | + |
| 8 | + $( "#step2header" ).show(); |
| 9 | + $( "#step2wrapper" ).show(); |
| 10 | + |
| 11 | + // check for RapidHtml errors and display, if any |
| 12 | + var amountErrorString = "", |
| 13 | + billingErrorString = "", |
| 14 | + paymentErrorString = ""; |
| 15 | + |
| 16 | + // generate formatted errors to display |
| 17 | + var temp = []; |
| 18 | + for ( var e in amountErrors ) |
| 19 | + if ( amountErrors[e] != "" ) |
| 20 | + temp[temp.length] = amountErrors[e]; |
| 21 | + amountErrorString = temp.join( "<br />" ); |
| 22 | + |
| 23 | + temp = []; |
| 24 | + for ( var f in billingErrors ) |
| 25 | + if ( billingErrors[f] != "" ) |
| 26 | + temp[temp.length] = billingErrors[f]; |
| 27 | + billingErrorString = temp.join( "<br />" ); |
| 28 | + |
| 29 | + temp = []; |
| 30 | + for ( var g in paymentErrors ) |
| 31 | + if ( paymentErrors[g] != "" ) |
| 32 | + temp[temp.length] = paymentErrors[g]; |
| 33 | + paymentErrorString = temp.join( "<br />" ); |
| 34 | + |
| 35 | + // show the errors |
| 36 | + var prevError = false; |
| 37 | + if ( amountErrorString != "" ) { |
| 38 | + $( "#amtErrorMessages" ).html( amountErrorString ); |
| 39 | + } |
| 40 | + if ( billingErrorString != "" ) { |
| 41 | + $( "#billingErrorMessages" ).html( billingErrorString ); |
| 42 | + } |
| 43 | + if ( paymentErrorString != "" ) { |
| 44 | + $( "#paymentErrorMessages" ).html( paymentErrorString ); |
| 45 | + } |
| 46 | + |
| 47 | + $( "#paymentContinueBtn" ).live( "click", function() { |
| 48 | + if ( validate_personal( document.paypalcontribution ) ) { |
| 49 | + displayCreditCardForm() |
| 50 | + } |
| 51 | + } ); |
| 52 | + // Set the cards to progress to step 3 |
| 53 | + $( ".cardradio" ).live( "click", function() { |
| 54 | + if ( validate_personal( document.paypalcontribution ) ) { |
| 55 | + displayCreditCardForm() |
| 56 | + } |
| 57 | + else { |
| 58 | + // show the continue button to indicate how to get to step 3 since they |
| 59 | + // have already clicked on a card image |
| 60 | + $( "#paymentContinue" ).show(); |
| 61 | + } |
| 62 | + } ); |
| 63 | + |
| 64 | + // init all of the header actions |
| 65 | + $( "#step2header" ).click( function() { |
| 66 | + showStep2(); |
| 67 | + } ); |
| 68 | + $( "#step3header" ).click( function() { |
| 69 | + displayCreditCardForm(); |
| 70 | + } ); |
| 71 | +} ); |
| 72 | + |
| 73 | +window.showStep2 = function() { |
| 74 | + if ( $( '#step3wrapper' ).is(":visible") ) { |
| 75 | + $( "#paymentContinue" ).show(); // Show continue button in 2nd section |
| 76 | + } |
| 77 | + // show the correct sections |
| 78 | + $( "#step2wrapper" ).slideDown(); |
| 79 | + $( "#step3wrapper" ).slideUp(); |
| 80 | + $( "#change-billing" ).hide(); |
| 81 | + $( "#change-payment" ).show(); |
| 82 | + $( "#step2header" ).show(); // just in case |
| 83 | +} |
| 84 | + |
| 85 | +window.showStep3 = function() { |
| 86 | + // show the correct sections |
| 87 | + $( "#step2wrapper" ).slideUp(); |
| 88 | + $( "#step3wrapper" ).slideDown(); |
| 89 | + $( "#change-billing" ).show(); |
| 90 | + $( "#change-payment" ).hide(); |
| 91 | + $( "#step3header" ).show(); // just in case |
| 92 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/webitects2nd.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 93 | + native |