r77032 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77031‎ | r77032 | r77033 >
Date:21:20, 19 November 2010
Author:kaldari
Status:deferred
Tags:
Comment:
form fixes for one-steps
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/OneStepTwoColumn.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/OneStepTwoColumn.php
@@ -55,32 +55,43 @@
5656 i,
5757 output = '',
5858 currField = '';
59 -
60 - for( i = 0; i < numFields; i++ ) {
61 - if( document.getElementById( fields[i] ).value == '' ) {
62 - currField = window['payflowproGatewayErrorMsg'+ msg[i]];
63 - output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\\r\\n';
 59+
 60+ var doCheck = true;
 61+ if( typeof( document.payment.PaypalRedirect.value ) !== 'undefined' ) {
 62+ if( document.payment.PaypalRedirect.value ) {
 63+ doCheck = false;
6464 }
6565 }
6666
67 - if (document.getElementById('fname').value == '$first') {
68 - output += payflowproGatewayErrorMsgJs + ' first name.\\r\\n';
 67+ if( doCheck ) {
 68+ for( i = 0; i < numFields; i++ ) {
 69+ if( document.getElementById( fields[i] ).value == '' ) {
 70+ currField = window['payflowproGatewayErrorMsg'+ msg[i]];
 71+ output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\\r\\n';
 72+ }
 73+ }
 74+
 75+ if (document.getElementById('fname').value == '$first') {
 76+ output += payflowproGatewayErrorMsgJs + ' first name.\\r\\n';
 77+ }
 78+ if (document.getElementById('lname').value == '$last') {
 79+ output += payflowproGatewayErrorMsgJs + ' last name.\\r\\n';
 80+ }
 81+
 82+ // validate email address
 83+ var apos = document.payment.emailAdd.value.indexOf("@");
 84+ var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
 85+
 86+ if( apos < 1 || dotpos-apos < 2 ) {
 87+ output += payflowproGatewayErrorMsgEmail;
 88+ }
6989 }
70 - if (document.getElementById('lname').value == '$last') {
71 - output += payflowproGatewayErrorMsgJs + ' last name.\\r\\n';
72 - }
73 -
74 - // validate email address
75 - var apos = document.payment.emailAdd.value.indexOf("@");
76 - var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
77 -
78 - if( apos < 1 || dotpos-apos < 2 ) {
79 - output += payflowproGatewayErrorMsgEmail;
80 - }
8190
8291 if( output ) {
8392 alert( output );
8493 return false;
 94+ } else {
 95+ return true;
8596 }
8697 }
8798 </script>
@@ -152,7 +163,7 @@
153164 $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) );
154165 if ( $this->paypal ) {
155166 $form .= Html::hidden( 'PaypalRedirect', false );
156 - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button' ), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit' ) );
 167+ $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button' ), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';return true;', 'type' => 'submit' ) );
157168 } else {
158169 $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button' ), 'type' => 'submit' ) );
159170 $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button

Status & tagging log