MediaWiki:Resources/validation.js: Difference between revisions

Content deleted Content added
Pgehres (WMF) (talk | contribs)
No edit summary
Awight (WMF) (talk | contribs)
reject all funny punctuation, with a "valid amount" error
Line 34:
if ( form.input_amount_other_box.value != "" ) {
var otherAmount = form.input_amount_other_box.value;
otherAmount = otherAmount.replace(/[,.](\d\d)$/, '\:.$101');
otherAmount = otherAmount.replace(/[,.](\d)(\d)$/, '\:$1$2');
otherAmount = otherAmount.replace(/[\$,.]/g, '');
otherAmount = otherAmount.replace(/:/, '.');
form.input_amount_other_box.value = otherAmount;
form.amountGiven.value = otherAmount;
Line 50 ⟶ 47:
minimums[currency] = 1;
}
if ( amount < minimums[currency] || error ) {
$( "#input_amount_other" ).focus();
$( "#input_amount_other_box" ).focus();
alert( '</html>{{int:donate_interface-amount-error}}<html>' );
} else if ( amount < minimums[currency] ) {
$( "#input_amount_other_box" ).val( '' );
$( "#input_amount_other" ).focus();