dgraham 2002/12/08 21:06:02 Modified: conf/share validator-rules.xml Log: Fixed validateFloat for PR # 7353. Revision Changes Path 1.19 +29 -15 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.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- validator-rules.xml 9 Dec 2002 04:56:16 -0000 1.18 +++ validator-rules.xml 9 Dec 2002 05:06:02 -0000 1.19 @@ -254,9 +254,9 @@ var field = form[oByte[x][0]]; if (field.type == 'text' || - field.type == 'textarea' || - field.type == 'select-one' || - field.type == 'radio') { + field.type == 'textarea' || + field.type == 'select-one' || + field.type == 'radio') { var value; // get field's value @@ -416,18 +416,32 @@ var fields = new Array(); oFloat = new FloatValidations(); for (x in oFloat) { - if ((form[oFloat[x][0]].type == 'text' || - form[oFloat[x][0]].type == 'textarea' || - form[oFloat[x][0]].type == 'select-one' || - form[oFloat[x][0]].type == 'radio') && - (form[oFloat[x][0]].value.length > 0)) { - var iValue = parseFloat(form[oFloat[x][0]].value); - if (isNaN(iValue)) { - if (i == 0) { - focusField = form[oFloat[x][0]]; - } - fields[i++] = oFloat[x][1]; - bValid = false; + var field = form[oFloat[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 = parseFloat(value); + if (isNaN(iValue)) { + if (i == 0) { + focusField = field; + } + fields[i++] = oFloat[x][1]; + bValid = false; + } } } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>