Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/lightbox1.js |
— | — | @@ -7,6 +7,23 @@ |
8 | 8 | modal: true, |
9 | 9 | title: 'Donate by Credit Card' |
10 | 10 | } ); |
| 11 | + |
| 12 | + // If the form is being reloaded, restore the amount |
| 13 | + var previousAmount = $( 'input[name="amount"]' ).val(); |
| 14 | + if ( previousAmount ) { |
| 15 | + var matched = false; |
| 16 | + $( 'input[name="amountRadio"]' ).each( function( index ) { |
| 17 | + if ( $( this ).val() == previousAmount ) { |
| 18 | + $( this ).attr( 'checked', true ); |
| 19 | + matched = true; |
| 20 | + } |
| 21 | + } ); |
| 22 | + if ( !matched ) { |
| 23 | + $( 'input#input_amount_other' ).attr( 'checked', true ); |
| 24 | + $( 'input#other-amount' ).val( previousAmount ); |
| 25 | + } |
| 26 | + } |
| 27 | + |
11 | 28 | $( '#cc' ).click( function() { |
12 | 29 | if ( validateAmount( document.paypalcontribution ) ) { |
13 | 30 | $( '#dialog' ).dialog( 'open' ); |
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js |
— | — | @@ -56,6 +56,22 @@ |
57 | 57 | } |
58 | 58 | showAmount( $( 'input[name="amount"]' ) ); // lets go ahead and assume there is something to show |
59 | 59 | } |
| 60 | + |
| 61 | + // If the form is being reloaded, restore the amount |
| 62 | + var previousAmount = $( 'input[name="amount"]' ).val(); |
| 63 | + if ( previousAmount ) { |
| 64 | + var matched = false; |
| 65 | + $( 'input[name="amountRadio"]' ).each( function( index ) { |
| 66 | + if ( $( this ).val() == previousAmount ) { |
| 67 | + $( this ).attr( 'checked', true ); |
| 68 | + matched = true; |
| 69 | + } |
| 70 | + } ); |
| 71 | + if ( !matched ) { |
| 72 | + $( 'input#input_amount_other' ).attr( 'checked', true ); |
| 73 | + $( 'input#other-amount' ).val( previousAmount ); |
| 74 | + } |
| 75 | + } |
60 | 76 | |
61 | 77 | $( "#cc" ).click( function() { |
62 | 78 | /* safety check for people who hit the back button */ |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/webitects_2_3step.js |
— | — | @@ -56,6 +56,22 @@ |
57 | 57 | } |
58 | 58 | showAmount( $( 'input[name="amount"]' ) ); // lets go ahead and assume there is something to show |
59 | 59 | } |
| 60 | + |
| 61 | + // If the form is being reloaded, restore the amount |
| 62 | + var previousAmount = $( 'input[name="amount"]' ).val(); |
| 63 | + if ( previousAmount ) { |
| 64 | + var matched = false; |
| 65 | + $( 'input[name="amountRadio"]' ).each( function( index ) { |
| 66 | + if ( $( this ).val() == previousAmount ) { |
| 67 | + $( this ).attr( 'checked', true ); |
| 68 | + matched = true; |
| 69 | + } |
| 70 | + } ); |
| 71 | + if ( !matched ) { |
| 72 | + $( 'input#input_amount_other' ).attr( 'checked', true ); |
| 73 | + $( 'input#other-amount' ).val( previousAmount ); |
| 74 | + } |
| 75 | + } |
60 | 76 | |
61 | 77 | $( "#cc" ).click( function() { |
62 | 78 | if ( validateAmount() ) { |