DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17835>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17835 The javascript code to validate integers does not display an alert box if the number being validated has invalid digits. (i.e. floating point numbers) Summary: The javascript code to validate integers does not display an alert box if the number being validated has invalid digits. (i.e. floating point numbers) Product: Struts Version: Unknown Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: Validator Framework AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The javascript code to validate integers does not display an alert box if the number being validated has invalid digits. (i.e. floating point numbers) Solution to correct the problem in file validator-rules.xml 1. If the call to function isAllDigits fails, then variables focusField and fields should be set properly so an alert message can be presented to the user. Example function validateInteger(form) { var bValid = true; var focusField = null; var i = 0; var fields = new Array(); oInteger = new IntegerValidations(); for (x in oInteger) { var field = form[oInteger[x][0]]; if (field.type == 'text' || field.type == 'textarea' || field.type == 'select-one' || field.type == 'radio') { var value = ''; // get field's value if (field.type == "select-one") { var si = field.selectedIndex; if (si >= 0) { value = field.options[si].value; } } else { value = field.value; } if (value.length > 0) { if (!isAllDigits(value)) { if (i == 0) { focusField = field; } fields[i++] = oInteger[x][1]; bValid = false; } else { var iValue = parseInt(value); if (isNaN(iValue) || !(iValue >= - 2147483648 && iValue <= 2147483647)) { if (i == 0) { focusField = field; } fields[i++] = oInteger[x][1]; bValid = false; } } } } } if (fields.length > 0) { focusField.focus(); alert(fields.join('\n')); } return bValid; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
