Index: trunk/extensions/DonationInterface/payflowpro_gateway/form_placeholders.js |
— | — | @@ -20,9 +20,11 @@ |
21 | 21 | currField = ''; |
22 | 22 | |
23 | 23 | for( i = 0; i < numFields; i++ ) { |
24 | | - if( document.getElementById( fields[i] ).value == '' ) { |
25 | | - currField = mw.msg( 'donate_interface-error-msg-' + fields[i] ); |
26 | | - output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + currField + '.\r\n'; |
| 24 | + if ( document.getElementById( fields[i] ) ) { // Make sure field exists |
| 25 | + if( document.getElementById( fields[i] ).value == '' ) { |
| 26 | + currField = mw.msg( 'donate_interface-error-msg-' + fields[i] ); |
| 27 | + output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + currField + '.\r\n'; |
| 28 | + } |
27 | 29 | } |
28 | 30 | } |
29 | 31 | |
Index: trunk/extensions/DonationInterface/modules/validate_input.js |
— | — | @@ -55,10 +55,12 @@ |
56 | 56 | var fields = ['fname','lname','street','city','zip', 'emailAdd'], |
57 | 57 | numFields = fields.length; |
58 | 58 | for( i = 0; i < numFields; i++ ) { |
59 | | - // See if the field is empty or equal to the placeholder |
60 | | - if( document.getElementById( fields[i] ).value == '' || document.getElementById( fields[i] ).value == mw.msg( 'donate_interface-donor-'+fields[i] ) ) { |
61 | | - currField = mw.msg( 'donate_interface-error-msg-' + fields[i] ); |
62 | | - output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + currField + '.\r\n'; |
| 59 | + if ( document.getElementById( fields[i] ) ) { // Make sure field exists |
| 60 | + // See if the field is empty or equal to the placeholder |
| 61 | + if( document.getElementById( fields[i] ).value == '' || document.getElementById( fields[i] ).value == mw.msg( 'donate_interface-donor-'+fields[i] ) ) { |
| 62 | + currField = mw.msg( 'donate_interface-error-msg-' + fields[i] ); |
| 63 | + output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + currField + '.\r\n'; |
| 64 | + } |
63 | 65 | } |
64 | 66 | } |
65 | 67 | |
— | — | @@ -118,10 +120,12 @@ |
119 | 121 | var fields = ['fname','lname','street','city','zip', 'emailAdd', 'card_num','cvv'], |
120 | 122 | numFields = fields.length; |
121 | 123 | for( i = 0; i < numFields; i++ ) { |
122 | | - // See if the field is empty or equal to the placeholder |
123 | | - if( document.getElementById( fields[i] ).value == '' || document.getElementById( fields[i] ).value == mw.msg( 'donate_interface-donor-'+fields[i] ) ) { |
124 | | - currField = mw.msg( 'donate_interface-error-msg-' + fields[i] ); |
125 | | - output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + currField + '.\r\n'; |
| 124 | + if ( document.getElementById( fields[i] ) ) { // Make sure field exists |
| 125 | + // See if the field is empty or equal to the placeholder |
| 126 | + if( document.getElementById( fields[i] ).value == '' || document.getElementById( fields[i] ).value == mw.msg( 'donate_interface-donor-'+fields[i] ) ) { |
| 127 | + currField = mw.msg( 'donate_interface-error-msg-' + fields[i] ); |
| 128 | + output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + currField + '.\r\n'; |
| 129 | + } |
126 | 130 | } |
127 | 131 | } |
128 | 132 | |