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 2002/09/19 18:52:03 UTC
DO NOT REPLY [Bug 12821] New: -
Password fields are not validated against minLength on javascript side
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=12821>.
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=12821
Password fields are not validated against minLength on javascript side
Summary: Password fields are not validated against minLength on
javascript side
Product: Struts
Version: Nightly Build
Platform: All
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Validator Framework
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: phpsurf@ifrance.com
In the javascript function validateMinLength(form) forgets to apply its
validation control to form fields of type 'password' and only validates
against 'text' and 'textarea'.
here the patch:
<validator name="minlength"
classname="org.apache.struts.util.StrutsValidator"
method="validateMinLength"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends="required"
msg="errors.minlength">
<javascript><![CDATA[
function validateMinLength(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMinLength = new minlength();
for (x in oMinLength) {
if (form[oMinLength[x][0]].type == 'text' ||
form[oMinLength[x][0]].type == 'textarea' ||
form[oMinLength[x][0]].type == 'password') {
var iMin = parseInt(oMinLength[x][2]("minlength"));
if (!(form[oMinLength[x][0]].value.length >= iMin)) {
if (i == 0) {
focusField = form[oMinLength[x][0]];
}
fields[i++] = oMinLength[x][1];
bValid = false;
}
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return bValid;
}]]>
</javascript>
</validator>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>