Mwalker has uploaded a new change for review. https://gerrit.wikimedia.org/r/134245
Change subject: Validate form fields using element ID ...................................................................... Validate form fields using element ID ... instead of form.<name> because the worldpay form doesn't use the names. As an aside; TODO: cleanup in this file is heavily needed. Change-Id: If70f5669890dbcf0a0d9c81af6b8d3ed27aaa4a7 --- M modules/validate_input.js 1 file changed, 9 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/45/134245/1 diff --git a/modules/validate_input.js b/modules/validate_input.js index e0b040b..2bafba8 100644 --- a/modules/validate_input.js +++ b/modules/validate_input.js @@ -131,18 +131,19 @@ } // validate email address - if ( $.trim( document.getElementById( 'emailAdd' ).value ) && document.getElementById( 'emailAdd' ).value != mw.msg( 'donate_interface-donor-emailAdd' ) ) { + var $emailAdd = document.getElementById( 'emailAdd' ); + if ( $.trim( $emailAdd.value ) && $emailAdd.value != mw.msg( 'donate_interface-donor-emailAdd' ) ) { var invalid = false; - var apos = form.emailAdd.value.indexOf("@"); - var dotpos = form.emailAdd.value.lastIndexOf("."); + var apos = $emailAdd.value.indexOf("@"); + var dotpos = $emailAdd.value.lastIndexOf("."); if( apos < 1 || dotpos-apos < 2 ) { output += mw.msg( 'donate_interface-error-msg-email' ) + '.\r\n'; invalid = true; } - var domain = form.emailAdd.value.substring( apos + 1 ); + var domain = $emailAdd.value.substring( apos + 1 ); var invalids = ["..", "/", "\\", ",", "<", ">"]; @@ -212,9 +213,10 @@ } // validate email address - if ( $.trim( document.getElementById( 'emailAdd' ).value ) && document.getElementById( 'emailAdd' ).value != mw.msg( 'donate_interface-donor-emailAdd' ) ) { - var apos = form.emailAdd.value.indexOf("@"); - var dotpos = form.emailAdd.value.lastIndexOf("."); + var $emailAdd = document.getElementById( 'emailAdd' ); + if ( $.trim( $emailAdd.value ) && $emailAdd.value != mw.msg( 'donate_interface-donor-emailAdd' ) ) { + var apos = $emailAdd.value.indexOf("@"); + var dotpos = $emailAdd.value.lastIndexOf("."); if( apos < 1 || dotpos-apos < 2 ) { output += mw.msg( 'donate_interface-error-msg-email' ) + '.\r\n'; -- To view, visit https://gerrit.wikimedia.org/r/134245 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If70f5669890dbcf0a0d9c81af6b8d3ed27aaa4a7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: master Gerrit-Owner: Mwalker <mwal...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits