Index: trunk/extensions/DonationInterface/payflowpro_gateway/validate_input.js |
— | — | @@ -40,20 +40,28 @@ |
41 | 41 | } |
42 | 42 | |
43 | 43 | function validate_form( form ) { |
44 | | - var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'State', 'Zip', 'CardNum', 'Cvv' ]; |
45 | | - |
46 | | - var fields = ["emailAdd","fname","lname","street","city","state","zip","card_num","cvv" ], |
47 | | - numFields = fields.length, |
48 | | - i, |
49 | | - output = '', |
50 | | - currField = ''; |
51 | | - |
| 44 | + var output = ''; |
| 45 | + var currField = ''; |
| 46 | + var i = 0; |
| 47 | + var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'Zip', 'CardNum', 'Cvv' ]; |
| 48 | + var fields = ["emailAdd","fname","lname","street","city","zip","card_num","cvv" ], |
| 49 | + numFields = fields.length; |
52 | 50 | for( i = 0; i < numFields; i++ ) { |
53 | 51 | if( document.getElementById( fields[i] ).value == '' ) { |
54 | 52 | currField = window['payflowproGatewayErrorMsg'+ msg[i]]; |
55 | 53 | output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\r\n'; |
56 | 54 | } |
57 | 55 | } |
| 56 | + var stateField = document.getElementById( 'state' ); |
| 57 | + var countryField = document.getElementById( 'country' ); |
| 58 | + if( stateField.options[stateField.selectedIndex].value == 'YY' ) { |
| 59 | + output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsgState'] + '.\r\n'; |
| 60 | + } |
| 61 | + if( countryField.options[countryField.selectedIndex].value == '' ) { |
| 62 | + output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsgCountry'] + '.\r\n'; |
| 63 | + } |
| 64 | + output += "State:" + stateField.options[stateField.selectedIndex].value + '.\r\n'; |
| 65 | + output += "Country:" + countryField.options[countryField.selectedIndex].value + '.\r\n'; |
58 | 66 | |
59 | 67 | //set state to "outside us" |
60 | 68 | if ( document.payment.country.value != '840' ) { |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -69,6 +69,7 @@ |
70 | 70 | 'payflowproGatewayErrorMsgCity' => wfMsg( 'payflowpro_gateway-error-msg-city' ), |
71 | 71 | 'payflowproGatewayErrorMsgState' => wfMsg( 'payflowpro_gateway-error-msg-state' ), |
72 | 72 | 'payflowproGatewayErrorMsgZip' => wfMsg( 'payflowpro_gateway-error-msg-zip' ), |
| 73 | + 'payflowproGatewayErrorMsgCountry' => wfMsg( 'payflowpro_gateway-error-msg-country' ), |
73 | 74 | 'payflowproGatewayErrorMsgCardNum' => wfMsg( 'payflowpro_gateway-error-msg-card_num' ), |
74 | 75 | 'payflowproGatewayErrorMsgExpiration' => wfMsg( 'payflowpro_gateway-error-msg-expiration' ), |
75 | 76 | 'payflowproGatewayErrorMsgCvv' => wfMsg( 'payflowpro_gateway-error-msg-cvv' ), |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetterCA.php |
— | — | @@ -198,37 +198,4 @@ |
199 | 199 | return $state_menu; |
200 | 200 | } |
201 | 201 | |
202 | | - public function generateCountryDropdown( $defaultCountry = 124 ) { |
203 | | - $country_options = ''; |
204 | | - |
205 | | - // create a new array of countries with potentially translated country names for alphabetizing later |
206 | | - foreach ( $this->getCountries() as $iso_value => $full_name ) { |
207 | | - $countries[ $iso_value ] = wfMsg( 'payflowpro_gateway-country-dropdown-' . $iso_value ); |
208 | | - } |
209 | | - |
210 | | - // alphabetically sort the country names |
211 | | - asort( $countries, SORT_STRING ); |
212 | | - |
213 | | - // generate a dropdown option for each country |
214 | | - foreach ( $countries as $iso_value => $full_name ) { |
215 | | - if ( $this->form_data[ 'country' ] ) { |
216 | | - $selected = ( $iso_value == $this->form_data[ 'country' ] ) ? true : false; |
217 | | - } else { |
218 | | - $selected = ( $iso_value == $defaultCountry ) ? true : false; // Select default |
219 | | - } |
220 | | - $country_options .= Xml::option( $full_name, $iso_value, $selected ); |
221 | | - } |
222 | | - |
223 | | - // build the actual select |
224 | | - $country_menu = Xml::openElement( |
225 | | - 'select', |
226 | | - array( |
227 | | - 'name' => 'country', |
228 | | - 'id' => 'country' |
229 | | - ) ); |
230 | | - $country_menu .= $country_options; |
231 | | - $country_menu .= Xml::closeElement( 'select' ); |
232 | | - |
233 | | - return $country_menu; |
234 | | - } |
235 | 202 | } |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/Form.php |
— | — | @@ -137,7 +137,7 @@ |
138 | 138 | * (see http://us.php.net/asort) |
139 | 139 | * @return string |
140 | 140 | */ |
141 | | - public function generateCountryDropdown( $defaultCountry = 840 ) { |
| 141 | + public function generateCountryDropdown( $defaultCountry = null ) { |
142 | 142 | $country_options = ''; |
143 | 143 | |
144 | 144 | // create a new array of countries with potentially translated country names for alphabetizing later |
— | — | @@ -163,9 +163,9 @@ |
164 | 164 | 'select', |
165 | 165 | array( |
166 | 166 | 'name' => 'country', |
167 | | - 'id' => 'country', |
168 | | - 'onchange' => 'return disableStates( this )' |
| 167 | + 'id' => 'country' |
169 | 168 | ) ); |
| 169 | + $country_menu .= Xml::option( wfMsg( 'payflowpro_gateway-select-country' ), '', false ); |
170 | 170 | $country_menu .= $country_options; |
171 | 171 | $country_menu .= Xml::closeElement( 'select' ); |
172 | 172 | |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php |
— | — | @@ -36,9 +36,9 @@ |
37 | 37 | addEvent( window, 'load', loadPlaceholders ); |
38 | 38 | |
39 | 39 | function formCheck( ccform ) { |
40 | | - var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'State', 'Zip', 'CardNum', 'Cvv' ]; |
| 40 | + var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'Zip', 'CardNum', 'Cvv' ]; |
41 | 41 | |
42 | | - var fields = ["emailAdd","fname","lname","street","city","state","zip","card_num","cvv" ], |
| 42 | + var fields = ["emailAdd","fname","lname","street","city","zip","card_num","cvv" ], |
43 | 43 | numFields = fields.length, |
44 | 44 | i, |
45 | 45 | output = '', |
— | — | @@ -57,6 +57,14 @@ |
58 | 58 | if (document.getElementById('lname').value == '$last') { |
59 | 59 | output += payflowproGatewayErrorMsgJs + ' last name.\\r\\n'; |
60 | 60 | } |
| 61 | + var stateField = document.getElementById( 'state' ); |
| 62 | + if( stateField.options[stateField.selectedIndex].value == 'YY' ) { |
| 63 | + output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsgState'] + '.\\r\\n'; |
| 64 | + } |
| 65 | + var countryField = document.getElementById( 'country' ); |
| 66 | + if( countryField.options[countryField.selectedIndex].value == '' ) { |
| 67 | + output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsgCountry'] + '.\\r\\n'; |
| 68 | + } |
61 | 69 | |
62 | 70 | // validate email address |
63 | 71 | var apos = document.payment.emailAdd.value.indexOf("@"); |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter3.php |
— | — | @@ -58,9 +58,9 @@ |
59 | 59 | addEvent( window, 'load', loadPlaceholders ); |
60 | 60 | |
61 | 61 | function formCheck( ccform ) { |
62 | | - var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'State', 'Zip', 'CardNum', 'Cvv' ]; |
| 62 | + var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'Zip', 'CardNum', 'Cvv' ]; |
63 | 63 | |
64 | | - var fields = ["emailAdd","fname","lname","street","city","state","zip","card_num","cvv" ], |
| 64 | + var fields = ["emailAdd","fname","lname","street","city","zip","card_num","cvv" ], |
65 | 65 | numFields = fields.length, |
66 | 66 | i, |
67 | 67 | output = '', |
— | — | @@ -88,6 +88,11 @@ |
89 | 89 | if (document.getElementById('zip').value == '$zip') { |
90 | 90 | output += payflowproGatewayErrorMsgJs + ' zip code.\\r\\n'; |
91 | 91 | } |
| 92 | + |
| 93 | + var stateField = document.getElementById( 'state' ); |
| 94 | + if( stateField.options[stateField.selectedIndex].value == '' ) { |
| 95 | + output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsgState'] + '.\\r\\n'; |
| 96 | + } |
92 | 97 | |
93 | 98 | // validate email address |
94 | 99 | var apos = document.payment.emailAdd.value.indexOf("@"); |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php |
— | — | @@ -62,6 +62,7 @@ |
63 | 63 | 'payflowpro_gateway-error-msg-city' => 'city', |
64 | 64 | 'payflowpro_gateway-error-msg-state' => 'state', |
65 | 65 | 'payflowpro_gateway-error-msg-zip' => 'postal code', |
| 66 | + 'payflowpro_gateway-error-msg-country' => 'country', |
66 | 67 | 'payflowpro_gateway-error-msg-card_num' => 'credit card number', |
67 | 68 | 'payflowpro_gateway-error-msg-expiration' => "card's expiration date", |
68 | 69 | 'payflowpro_gateway-error-msg-cvv' => 'CVV from the back of your card', |
— | — | @@ -142,7 +143,7 @@ |
143 | 144 | 'payflowpro_gateway-zip-postal-code' => 'Zip/Postal code', |
144 | 145 | 'payflowpro_gateway-billing-code' => 'Billing zip', |
145 | 146 | 'payflowpro_gateway-country' => 'Country', |
146 | | - 'payflowpro_gateway-select-country' => 'Select country', |
| 147 | + 'payflowpro_gateway-select-country' => 'Select a country', |
147 | 148 | 'payflowpro_gateway-confirm-email' => 'Confirm e-mail', |
148 | 149 | 'payflowpro_gateway-phone' => 'Phone', |
149 | 150 | 'payflowpro_gateway-telephone' => 'Telephone', |
— | — | @@ -217,7 +218,7 @@ |
218 | 219 | 'payflowpro_gateway-on-the-back' => 'With this on the back:', |
219 | 220 | |
220 | 221 | // For more USA states, see payflowpro_gateway.us-states.i18n.php. |
221 | | - 'payflowpro_gateway-state-dropdown-YY' => 'Select a State', |
| 222 | + 'payflowpro_gateway-state-dropdown-YY' => 'Select a state', |
222 | 223 | 'payflowpro_gateway-state-dropdown-XX' => 'Outside the U.S.', |
223 | 224 | ); |
224 | 225 | |