MediaWiki:Resources/validation.js: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary |
Awight (WMF) (talk | contribs) reject all funny punctuation, with a "valid amount" error |
||
Line 34: | Line 34: | ||
if ( form.input_amount_other_box.value != "" ) { |
if ( form.input_amount_other_box.value != "" ) { |
||
var otherAmount = form.input_amount_other_box.value; |
var otherAmount = form.input_amount_other_box.value; |
||
otherAmount = otherAmount.replace(/[,.](\d)$/, ' |
otherAmount = otherAmount.replace(/[,.](\d\d)$/, '.$1'); |
||
otherAmount = otherAmount.replace(/[,.](\d)(\d)$/, '\:$1$2'); |
|||
otherAmount = otherAmount.replace(/[\$,.]/g, ''); |
|||
otherAmount = otherAmount.replace(/:/, '.'); |
|||
form.input_amount_other_box.value = otherAmount; |
form.input_amount_other_box.value = otherAmount; |
||
form.amountGiven.value = otherAmount; |
form.amountGiven.value = otherAmount; |
||
Line 50: | Line 47: | ||
minimums[currency] = 1; |
minimums[currency] = 1; |
||
} |
} |
||
if ( |
if ( 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_box" ).val( '' ); |
||
$( "#input_amount_other" ).focus(); |
$( "#input_amount_other" ).focus(); |