You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/03/11 04:13:42 UTC

DO NOT REPLY [Bug 17854] New: - Integer validation does not give an alert.

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=17854>.
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=17854

Integer validation does not give an alert.

           Summary: Integer validation does not give an alert.
           Product: Struts
           Version: 1.1 RC1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Validator Framework
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: hemant.mithbaokar@openwave.com


When you try to validate integer using validation framework it does
validate the form field but does not give an alert.

In the function function validateInteger(form) I noticed that the following
code


if (!isAllDigits(value)) {
   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'));
}

The alert is only fired when the fields array is populated. The function
isAllDigits correctly checks for characters in the form field. It also sets
the validity to false if any of the character is not a digit. But it does
not set the fields array with a error message. So how will the alert trigger?

So if you input 3.2 then function isAllDigits returns false and sets the
validity to false. But does not set the fields array. So the user never
gets a alert.

Looks like a fix for a bug which I saw some time back where 8x was a valid
integer which broke this functionality. Am I right?

Let me know.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org