Client side maxlength validation on CF 7 issue
I'm working on a customer site running on CF7 on Solaris and am doing a down-and-dirty addition of form field validation and wanted to use cfinput validation. The following attempt to use maxlength:
<cfinput name="FIRST_NAME" type="text" id="First_Name"
size="35" value="#session.stItem.FIRST_NAME#" validate="maxlength"
message="This field can only be 5 characters long."
validateAt="onBlur" maxLength="15" />
causes a JS error box whenever anything is entered into the field. The code it generates on the field is:
onblur="if( ( this.value.length > null) ){ _CF_onErrorAlert(new Array('This field can only be 5 characters long.')); }"
which makes no sense.
If I add in the required attribute, it gets worse -- doing an AND when an OR should have been done. So
<cfinput name="FIRST_NAME" type="text" id="First_Name"
size="35" value="#session.stItem.FIRST_NAME#" validate="maxlength"
required="yes"
message="This field can only be 5 characters long."
validateAt="onBlur" maxLength="15" />
produces the following code:
onblur="if( !_CF_hasValue(this, 'TEXT', false) && ( this.value.length > null) ){ _CF_onErrorAlert(new Array('This field can only be 5 characters long.')); }"
I've googled for info on the above, but didn't find anything. Is there a known bug on this or am I missing something?
