Show better error messages when checking numerical inputs (bug #1207402).

This commit is contained in:
Michal Čihař
2005-07-10 20:35:58 +00:00
parent 92de72f143
commit 9216ba0729
128 changed files with 602 additions and 132 deletions

View File

@@ -280,7 +280,7 @@ function emptyFormElements(theForm, theFieldName)
*
* @return boolean whether a valid number has been submitted or not
*/
function checkFormElementInRange(theForm, theFieldName, min, max)
function checkFormElementInRange(theForm, theFieldName, message, min, max)
{
var theField = theForm.elements[theFieldName];
var val = parseInt(theField.value);
@@ -302,7 +302,7 @@ function checkFormElementInRange(theForm, theFieldName, min, max)
// It's a number but it is not between min and max
else if (val < min || val > max) {
theField.select();
alert(val + errorMsg2);
alert(message.replace('%d', val));
theField.focus();
return false;
}