Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/html/TwoStepTwoColumnLetter3.html |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <script type="text/javascript"> |
3 | 3 | mw.loader.load('pfp.form.rapidhtml.TwoStepTwoColumnLetter3'); |
4 | 4 | // these must go through RapidHTML and thus are inline |
5 | | -// var amountErrors = ['#general|escape','#retryMsg|escape','#amount|escape']; |
6 | | -// var billingErrors = ['#fname|escape','#lname|escape','#city|escape','#country|escape','#street|escape','#state|escape','#zip|escape','#emailAdd|escape']; |
7 | | -// var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape']; |
8 | | -// var actionURL = "@action"; |
9 | | -// var scriptPath = "@script_path"; |
| 5 | + var amountErrors = ['#general|escape','#retryMsg|escape','#amount|escape']; |
| 6 | + var billingErrors = ['#fname|escape','#lname|escape','#city|escape','#country|escape','#street|escape','#state|escape','#zip|escape','#emailAdd|escape']; |
| 7 | + var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape']; |
| 8 | + var actionURL = "@action"; |
| 9 | + var scriptPath = "@script_path"; |
10 | 10 | </script> |
11 | 11 | |
12 | 12 | <table width="100%" cellspacing="0" cellpadding="0" border="0"> |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/TwoStepTwoColumnLetter3.js |
— | — | @@ -0,0 +1,59 @@ |
| 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 | + // check for RapidHtml errors and display, if any |
| 9 | + var amountErrorString = "", |
| 10 | + billingErrorString = "", |
| 11 | + paymentErrorString = ""; |
| 12 | + |
| 13 | + // generate formatted errors to display |
| 14 | + var temp = []; |
| 15 | + for ( var e in amountErrors ) |
| 16 | + if ( amountErrors[e] != "" ) |
| 17 | + temp[temp.length] = amountErrors[e]; |
| 18 | + amountErrorString = temp.join( "<br />" ); |
| 19 | + |
| 20 | + temp = []; |
| 21 | + for ( var f in billingErrors ) |
| 22 | + if ( billingErrors[f] != "" ) |
| 23 | + temp[temp.length] = billingErrors[f]; |
| 24 | + billingErrorString = temp.join( "<br />" ); |
| 25 | + |
| 26 | + temp = []; |
| 27 | + for ( var g in paymentErrors ) |
| 28 | + if ( paymentErrors[g] != "" ) |
| 29 | + temp[temp.length] = paymentErrors[g]; |
| 30 | + paymentErrorString = temp.join( "<br />" ); |
| 31 | + |
| 32 | + // show the errors |
| 33 | + var prevError = false; |
| 34 | + if ( amountErrorString != "" ) { |
| 35 | + $( "#amtErrorMessages" ).html( amountErrorString ); |
| 36 | + } |
| 37 | + if ( billingErrorString != "" ) { |
| 38 | + $( "#billingErrorMessages" ).html( billingErrorString ); |
| 39 | + } |
| 40 | + if ( paymentErrorString != "" ) { |
| 41 | + $( "#paymentErrorMessages" ).html( paymentErrorString ); |
| 42 | + } |
| 43 | + |
| 44 | + $( "#ccSubmitButton" ).click( function() { |
| 45 | + // Safety check for people who hit the back button |
| 46 | + checkedValue = $( "input[name='amountRadio']:checked" ).val(); |
| 47 | + currenctAmount = $( 'input[name="amount"]' ).val(); |
| 48 | + // The currenctAmount could be set to empty string or '0.00' |
| 49 | + if ( ( currentAmount == '0.00' || currentAmount == '' ) && checkedValue && !isNaN( checkedValue ) ) { |
| 50 | + $( 'input[name="amount"]' ).val( checkedValue ); |
| 51 | + } |
| 52 | + if ( validateAmount() ) { |
| 53 | + if ( validate_form() ) { |
| 54 | + return true; |
| 55 | + } |
| 56 | + } |
| 57 | + return false; |
| 58 | + } ); |
| 59 | + |
| 60 | +} ); |
Index: trunk/extensions/DonationInterface/gateway_forms/rapidhtml/RapidHtmlResources.php |
— | — | @@ -208,8 +208,8 @@ |
209 | 209 | */ |
210 | 210 | $wgResourceModules[ 'pfp.form.rapidhtml.TwoStepTwoColumnLetter3' ] = array( |
211 | 211 | 'styles' => 'css/TwoStepTwoColumnLetter3.css', |
212 | | - 'scripts' => '', |
213 | | - 'dependencies' => array(), |
| 212 | + 'scripts' => 'js/TwoStepTwoColumnLetter3.js', |
| 213 | + 'dependencies' => array( 'di.form.core.validate' ), |
214 | 214 | 'localBasePath' => dirname( __FILE__ ).'/../../payflowpro_gateway/forms', |
215 | 215 | 'remoteExtPath' => $wgPayflowRapidHtmlRemoteExtPath, |
216 | 216 | ); |