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/01/20 16:05:38 UTC
DO NOT REPLY [Bug 16259] New: -
javascript validation fails for select-one
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=16259>.
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=16259
javascript validation fails for select-one
Summary: javascript validation fails for select-one
Product: Struts
Version: 1.1 Beta 3
Platform: All
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: Validator Framework
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: csaba.n@freemail.hu
The validator javascript method fails when a select-one doesn't have selected
option. It happens because the object's selectedIndex is (-1) - when nothing is
selected and the value read by the index of (-1) causes a javascript error:
if (field.type == "select-one") {
var si = field.selectedIndex;
value = field.options[si].value; //error if si == -1
}
the following code prevents this error:
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si == -1) {
value = '';
} else {
value = field.options[si].value;
}
}
The following validation methods are affected: required, byte, short, integer,
float.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>