Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate = "date"

Status
Not open for further replies.

kls44

Programmer
Aug 15, 2005
3
US
We are testing moving from CF6 to CF7. It seems the validate = 'date' in cfinput doesn't work. It generates javascript error 'object expected'.
The code in question is:
<cfinput type="Text" name="begdate"
required="Yes"
validate="date" message="Enter a valid Start date formatted as mm/dd/yyyy. >

Works fine CF6.
Anybody else had this problem?

kls44
 
Does any validation work (not just date)? If it doesn't, maybe the validation script (cfform.js) isn't accessible.
 
CF is generating js script for validation:
.
.
.
//form element begdate required check
if( _CF_hasValue(_CF_this['begdate'], "TEXT", false ) )
{
//form element begdate 'DATE' validation checks
if (!_CF_checkdate(_CF_this['begdate'].value, true))
{
_CF_onError(_CF_this, "begdate", _CF_this['begdate'].value, "Enter a valid Start date formatted as mm/dd/yyyy.");
_CF_error_exists = true;
}

}else {
_CF_onError(_CF_this, "begdate", _CF_this['begdate'].value, "Enter a valid Start date formatted as mm/dd/yyyy.");
_CF_error_exists = true;
}
.
.
.

It fails on the first 'if' statement.

I have tried to validate telephone & range with the same results. Also fails with no validation but just required=yes.

kls44
 
Thanks, cfStarlight!

That WAS the problem. The CFAdministrator didn't have the right directories in the path to cfform.js.

Thanks again,
kls44
 
Shouldn't CF have some built-in check that looks at this known issue and throws a descrptive error if the .js file is missing?

____________________________________
Just Imagine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top