Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js |
— | — | @@ -9,19 +9,44 @@ |
10 | 10 | if ( matches && matches[1] ) { |
11 | 11 | language = matches[1]; |
12 | 12 | } |
| 13 | + |
| 14 | + var currencyField = document.getElementById( 'currency' ); |
| 15 | + var currency = ''; |
| 16 | + if ( currencyField && currencyField.type == 'select-one' ) { // currency is a dropdown select |
| 17 | + currency = $( 'select#currency option:selected' ).val(); |
| 18 | + } else { |
| 19 | + currency = $( "input[name='currency_code']" ).val(); |
| 20 | + } |
| 21 | + |
| 22 | + var stateField = document.getElementById( 'state' ); |
| 23 | + var state = ''; |
| 24 | + if ( stateField && stateField.type == 'select-one' ) { // state is a dropdown select |
| 25 | + state = $( 'select#state option:selected' ).val(); |
| 26 | + } else { |
| 27 | + state = $( "input[name='state']" ).val(); |
| 28 | + } |
| 29 | + |
| 30 | + var countryField = document.getElementById( 'country' ); |
| 31 | + var country = ''; |
| 32 | + if ( countryField && countryField.type == 'select-one' ) { // country is a dropdown select |
| 33 | + country = $( 'select#country option:selected' ).val(); |
| 34 | + } else { |
| 35 | + country = $( "input[name='country']" ).val(); |
| 36 | + } |
| 37 | + |
13 | 38 | var sendData = { |
14 | 39 | 'action': 'donate', |
15 | 40 | 'gateway': 'globalcollect', |
16 | | - 'currency': $( "input[name='currency_code']" ).val(), |
| 41 | + 'currency': currency, |
17 | 42 | 'amount': $( "input[name='amount']" ).val(), |
18 | 43 | 'fname': $( "input[name='fname']" ).val(), |
19 | 44 | 'lname': $( "input[name='lname']" ).val(), |
20 | 45 | 'street': $( "input[name='street']" ).val(), |
21 | 46 | 'city': $( "input[name='city']" ).val(), |
22 | | - 'state': $( "input[name='state']" ).val(), |
| 47 | + 'state': state, |
23 | 48 | 'zip': $( "input[name='zip']" ).val(), |
24 | 49 | 'emailAdd': $( "input[name='emailAdd']" ).val(), |
25 | | - 'country': $( "input[name='country']" ).val(), |
| 50 | + 'country': country, |
26 | 51 | 'payment_method': 'cc', |
27 | 52 | 'language': language, |
28 | 53 | 'card_type': $( "input[name='cardtype']:checked" ).val().toLowerCase(), |