diff --git a/webtools/litmus/js/FormValidation.js b/webtools/litmus/js/FormValidation.js index b1f4f976a4b0..9f0c119b61ba 100644 --- a/webtools/litmus/js/FormValidation.js +++ b/webtools/litmus/js/FormValidation.js @@ -1,4 +1,5 @@ var iBugNumber = "This field must be a valid, positive integer (>0). Please re-enter it now."; +var iNumber = iBugNumber; var iEmail = "This field must be a valid email address (like foo@bar.com). Please re-enter it now."; var iBuildId = "This field must be a valid build id, which is a string of 8 digits most easily found in the About dialog. Please re-enter it now."; var iPasswordMismatch = "The passwords you entered did not match."; @@ -208,6 +209,24 @@ function checkBuildId (theField, emptyOK) } } +// checkNumber (TEXTFIELD theField [, BOOLEAN emptyOK==false]) +// +// Check that string theField.value is a valid, positive integer. +// +// For explanation of optional argument emptyOK, +// see comments of function isInteger. +function checkNumber (theField, emptyOK) +{ + if (checkNumber.arguments.length == 1) { + emptyOK = defaultEmptyOK; + } + + if (isPositiveInteger(theField.value,emptyOK)) { + return true; + } else { + return warnInvalid (theField, iNumber); + } +} // isInteger (STRING s [, BOOLEAN emptyOK]) // diff --git a/webtools/litmus/templates/en/default/reporting/search_results.tmpl b/webtools/litmus/templates/en/default/reporting/search_results.tmpl index 5cb2e05f4cee..1867cee04aa7 100644 --- a/webtools/litmus/templates/en/default/reporting/search_results.tmpl +++ b/webtools/litmus/templates/en/default/reporting/search_results.tmpl @@ -25,7 +25,7 @@ # ***** END LICENSE BLOCK ***** #%] -[% INCLUDE global/html_header.tmpl %] +[% INCLUDE global/html_header.tmpl js_files=['js/FormValidation.js'] %] [% INCLUDE global/litmus_header.tmpl %]