r102239 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102238‎ | r102239 | r102240 >
Date:03:23, 7 November 2011
Author:kaldari
Status:ok
Tags:
Comment:
checking for select lists in webitects globalcollect forms
Modified paths:
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js
@@ -9,19 +9,44 @@
1010 if ( matches && matches[1] ) {
1111 language = matches[1];
1212 }
 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+
1338 var sendData = {
1439 'action': 'donate',
1540 'gateway': 'globalcollect',
16 - 'currency': $( "input[name='currency_code']" ).val(),
 41+ 'currency': currency,
1742 'amount': $( "input[name='amount']" ).val(),
1843 'fname': $( "input[name='fname']" ).val(),
1944 'lname': $( "input[name='lname']" ).val(),
2045 'street': $( "input[name='street']" ).val(),
2146 'city': $( "input[name='city']" ).val(),
22 - 'state': $( "input[name='state']" ).val(),
 47+ 'state': state,
2348 'zip': $( "input[name='zip']" ).val(),
2449 'emailAdd': $( "input[name='emailAdd']" ).val(),
25 - 'country': $( "input[name='country']" ).val(),
 50+ 'country': country,
2651 'payment_method': 'cc',
2752 'language': language,
2853 'card_type': $( "input[name='cardtype']:checked" ).val().toLowerCase(),

Follow-up revisions

RevisionCommit summaryAuthorDate
r102241follow-up to r102239, correct id for currency select listkaldari03:27, 7 November 2011
r102243MFT r102191, r102195, r102196, r102200, r102203, r102213, r102214, r102215, r...awjrichards03:31, 7 November 2011

Status & tagging log