Skip to main content
Participant
May 15, 2006
Question

cfform validation not working

  • May 15, 2006
  • 1 reply
  • 770 views
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
This topic has been closed for replies.

1 reply

May 15, 2006
Christine, what's the home directory of your application?
Participant
May 15, 2006
Hi Dmitriy,

My ColdFusion Application is installed at C:\CFusionMX7 and my web application is installed at C:\Websites\domainname\html\.

Thanks! I hope this helps,
Christine
May 15, 2006
Christine, how do you usually access ColdFusion Administrator? Do you have some virtual directory setup or something?
If you don't have a virtual directory, try creating one and pointing to the actual CFIDE location. It looks like that your webserver does not really know about /CFIDE mapping and so it is looking for it in your C:\Websites\domainname\html\ folder as this is the home directory for your website. You need to either create a virtual directory to CFIDE and point it to the actual location, or simply move CFIDE in there. Is your webserver Apache or IIS?