Question
cfform validation not working
Hello,
I am having a problem getting cfform validation to work since I have switched to ColdFusion MX7. Looking through this forum, I have found that I might have my CFIDE\scripts folder mapped incorrectly, but I really don't think this is the case. In CF Admin on the mapping page, I have both:
Logical Path - /CFIDE
Directory Path - C:\wwwroot\CFIDE
Logical Path - /CFIDE/scripts
Directory Path - C:\wwwroot\CFIDE\scripts
Originally, only the first mapping existed, but I put in the second thinking it might fix it. It didn't.
The source of my code looks like this:
<script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>
<script type="text/javascript">
<!--
function _CF_checkCFForm_1(_CF_this)
{
//reset on submit
_CF_error_exists = false;
_CF_error_messages = new Array();
_CF_error_fields = new Object();
_CF_FirstErrorField = null;
//form element fromemail required check
if( !_CF_hasValue(_CF_this['fromemail'], "TEXT", false ) )
{
_CF_onError(_CF_this, "fromemail", _CF_this['fromemail'].value, "Please enter your email address");
_CF_error_exists = true;
}
//form element toemail1 required check
if( !_CF_hasValue(_CF_this['toemail1'], "TEXT", false ) )
{
_CF_onError(_CF_this, "toemail1", _CF_this['toemail1'].value, "Please enter a recipient's email address in the first box provided.");
_CF_error_exists = true;
}
//display error messages and return success
if( _CF_error_exists )
{
if( _CF_error_messages.length > 0 )
{
// show alert() message
_CF_onErrorAlert(_CF_error_messages);
// set focus to first form error, if the field supports js focus().
if( _CF_this[_CF_FirstErrorField].type == "text" )
{ _CF_this[_CF_FirstErrorField].focus(); }
}
return false;
}else {
return true;
}
}
//-->
</script>
I am getting the JS error on the first if statement, underlined above. The error is "Object Expected".
Anyone have any ideas as to what could be going on here?
Thanks!
Christine
I am having a problem getting cfform validation to work since I have switched to ColdFusion MX7. Looking through this forum, I have found that I might have my CFIDE\scripts folder mapped incorrectly, but I really don't think this is the case. In CF Admin on the mapping page, I have both:
Logical Path - /CFIDE
Directory Path - C:\wwwroot\CFIDE
Logical Path - /CFIDE/scripts
Directory Path - C:\wwwroot\CFIDE\scripts
Originally, only the first mapping existed, but I put in the second thinking it might fix it. It didn't.
The source of my code looks like this:
<script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>
<script type="text/javascript">
<!--
function _CF_checkCFForm_1(_CF_this)
{
//reset on submit
_CF_error_exists = false;
_CF_error_messages = new Array();
_CF_error_fields = new Object();
_CF_FirstErrorField = null;
//form element fromemail required check
if( !_CF_hasValue(_CF_this['fromemail'], "TEXT", false ) )
{
_CF_onError(_CF_this, "fromemail", _CF_this['fromemail'].value, "Please enter your email address");
_CF_error_exists = true;
}
//form element toemail1 required check
if( !_CF_hasValue(_CF_this['toemail1'], "TEXT", false ) )
{
_CF_onError(_CF_this, "toemail1", _CF_this['toemail1'].value, "Please enter a recipient's email address in the first box provided.");
_CF_error_exists = true;
}
//display error messages and return success
if( _CF_error_exists )
{
if( _CF_error_messages.length > 0 )
{
// show alert() message
_CF_onErrorAlert(_CF_error_messages);
// set focus to first form error, if the field supports js focus().
if( _CF_this[_CF_FirstErrorField].type == "text" )
{ _CF_this[_CF_FirstErrorField].focus(); }
}
return false;
}else {
return true;
}
}
//-->
</script>
I am getting the JS error on the first if statement, underlined above. The error is "Object Expected".
Anyone have any ideas as to what could be going on here?
Thanks!
Christine