Index: trunk/extensions/DonationInterface/payflowpro_gateway/validate_input.js |
— | — | @@ -59,16 +59,6 @@ |
60 | 60 | if ( document.payment.country.value != '840' ) { |
61 | 61 | document.payment.state.value = 'XX'; |
62 | 62 | } |
63 | | - |
64 | | - // validate name |
65 | | - /* |
66 | | - if (document.getElementById('fname').style.color == '#999999') { |
67 | | - output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsg' + msg['Fname']] + '.\r\n'; |
68 | | - } |
69 | | - if (document.getElementById('lname').style.color == '#999999') { |
70 | | - output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsg' + msg['Lname']] + '.\r\n'; |
71 | | - } |
72 | | - */ |
73 | 63 | |
74 | 64 | // validate email address |
75 | 65 | var apos = document.payment.emailAdd.value.indexOf("@"); |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter3.php |
— | — | @@ -57,6 +57,44 @@ |
58 | 58 | } |
59 | 59 | } |
60 | 60 | addEvent( window, 'load', loadPlaceholders ); |
| 61 | + |
| 62 | +function formCheck( ccform ) { |
| 63 | + var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'State', 'Zip', 'CardNum', 'Cvv' ]; |
| 64 | + |
| 65 | + var fields = ["emailAdd","fname","lname","street","city","state","zip","card_num","cvv" ], |
| 66 | + numFields = fields.length, |
| 67 | + i, |
| 68 | + output = '', |
| 69 | + currField = ''; |
| 70 | + |
| 71 | + for( i = 0; i < numFields; i++ ) { |
| 72 | + if( document.getElementById( fields[i] ).value == '' ) { |
| 73 | + currField = window['payflowproGatewayErrorMsg'+ msg[i]]; |
| 74 | + output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\r\n'; |
| 75 | + } |
| 76 | + } |
| 77 | + |
| 78 | + //set state to "outside us" |
| 79 | + if ( document.payment.country.value != '840' ) { |
| 80 | + document.payment.state.value = 'XX'; |
| 81 | + } |
| 82 | + |
| 83 | + // validate email address |
| 84 | + var apos = document.payment.emailAdd.value.indexOf("@"); |
| 85 | + var dotpos = document.payment.emailAdd.value.lastIndexOf("."); |
| 86 | + |
| 87 | + if( apos < 1 || dotpos-apos < 2 ) { |
| 88 | + output += payflowproGatewayErrorMsgEmail; |
| 89 | + } |
| 90 | + |
| 91 | + if( output ) { |
| 92 | + alert( output ); |
| 93 | + return false; |
| 94 | + } else { |
| 95 | + document.payment.submit(); |
| 96 | + return true; |
| 97 | + } |
| 98 | +} |
61 | 99 | </script> |
62 | 100 | EOT; |
63 | 101 | $wgOut->addHeadItem( 'placeholders', $js ); |
— | — | @@ -123,7 +161,7 @@ |
124 | 162 | // submit button |
125 | 163 | $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) ); |
126 | 164 | // $form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' )); |
127 | | - $form .= ' <br/>' . Xml::element( 'input', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/submit-donation-button.png", 'alt' => 'Submit donation', 'onclick' => 'submit_form( this )', 'type' => 'image' ) ); |
| 165 | + $form .= ' <br/>' . Xml::element( 'input', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/submit-donation-button.png", 'alt' => 'Submit donation', 'onclick' => 'formCheck( this )', 'type' => 'image' ) ); |
128 | 166 | $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button |
129 | 167 | $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
130 | 168 | Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/padlock.gif", 'style' => 'vertical-align:baseline;margin-right:4px;' ) ) . 'Your credit / debit card will be securely processed.'; |