dgraham 2002/12/08 20:56:16 Modified: conf/share validator-rules.xml Log: Fixed validateByte for PR # 7353. There are 4 other functions to fix though. Revision Changes Path 1.18 +28 -12 jakarta-struts/conf/share/validator-rules.xml Index: validator-rules.xml =================================================================== RCS file: /home/cvs/jakarta-struts/conf/share/validator-rules.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- validator-rules.xml 9 Dec 2002 03:45:23 -0000 1.17 +++ validator-rules.xml 9 Dec 2002 04:56:16 -0000 1.18 @@ -251,18 +251,34 @@ var fields = new Array(); oByte = new ByteValidations(); for (x in oByte) { - if ((form[oByte[x][0]].type == 'text' || - form[oByte[x][0]].type == 'textarea' || - form[oByte[x][0]].type == 'select-one' || - form[oByte[x][0]].type == 'radio') && - (form[oByte[x][0]].value.length > 0)) { - var iValue = parseInt(form[oByte[x][0]].value); - if (isNaN(iValue) || !(iValue >= -128 && iValue <= 127)) { - if (i == 0) - focusField = form[oByte[x][0]]; - fields[i++] = oByte[x][1]; - bValid = false; - } + var field = form[oByte[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; + value = field.options[si].value; + } else { + value = field.value; + } + + if (value.length > 0) { + + var iValue = parseInt(value); + if (isNaN(iValue) || !(iValue >= -128 && iValue <= 127)) { + if (i == 0) { + focusField = field; + } + fields[i++] = oByte[x][1]; + bValid = false; + } + } + } } if (fields.length > 0) {
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>