Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ColdFusion 8 - Required field not working on web, but works on local system

Posted on 2007-09-17
18
Medium Priority
?
1,230 Views
Last Modified: 2013-12-24
Hi, When I run the coldfusion file below with requirements to check the boxes before continuing, on my vista PC using CF8 local developer, everthing works fine - getting the popup window with description saying that I need to check before I can go next. However, when I download to web (link below) it does not give a prompt concerning unchecked boxes.  Any help will be much appreciated.  The ISP is using CF8.

http://www.svmgreen.com/employappl/HireEmployReq1.cfm

using CFFORMS....

<cfinput type="checkbox"  name="transportation" value="transportation" label="transportation" required="yes" message="Please check, have reliable transportation"/>
0
Comment
Question by:Nigel-SA
  • 8
  • 6
  • 3
  • +1
18 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 19909821
CFFORM uses javascript to validate the required fields.  If the javascript file is not accessible the validation doesn't work.  That appears to be the problem with your site.  Notice you get an http 404 error if you try and access one of the javascript files
http://www.svmgreen.com/CFIDE/scripts/cfform.js

See this technote on how to fix the issue
http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_18653&sliceId=2
0
 
LVL 52

Expert Comment

by:_agx_
ID: 19909823
> CFFORM uses javascript to validate the required fields.

_Your_ CFFORM uses javascript to validate the required fields.
0
 
LVL 13

Expert Comment

by:srikanthmadishetti
ID: 19912286
try to use js validate function

function validate()
{
var foundCount = 0;
for(i=0;i<document.getElementsByTagName("input").length;i++)
{
if(document.getElementsByTagName("input")[i].type == "checkbox")
{
if(document.getElementsByTagName("input")[i].checked == true)
{
foundCount++;
}
}

}


if(foundCount ==0)
{
alert("please check ");
return false;
}
else
{
return true;
}
}
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 13

Expert Comment

by:srikanthmadishetti
ID: 19912306
the above one checks if user had checked atleast one check box
0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 19914893
you should copy the /cfide/scripts (usually located on the server at c:\inetpub\wwwroot\cfide\scripts\)folder into a new directory within your webroot. In CF8 you can actually change the name of the folder to whatever you want and then specify the new folder name in coldfusion administrator if you are concerned that. but for now if you just copy that cfide/scripts/ folder and all it's contents to your webroot everything will work fine.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 19914926
> copy that cfide/scripts/ folder and all it's contents to your webroot everything will work fine.

Yes that's one of the options in the technote mentioned above

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_18653&sliceId=2
* Copy the /CFIDE/scripts directory into the webroot of the new site.
0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 19914958
I clicked on the tech note and couldn't see anything all I can see is:

TechNote
cfform errors with ColdFusion MX on multihomed servers

TechNote DetailsLast Update: 05-12-2005
ID: tn_18653
Browser: All
 
Permanent Link: http://www.adobe.com/go/tn_18653 
Products Affected: ColdFusion
 
I have been having that problem with the adobe tech notes for along time now..
0
 
LVL 52

Expert Comment

by:_agx_
ID: 19914999
The kb section of the site seems to be down a lot lately, but I can view it with both firefox and IE.  Though it did throw a javascript error in IE.

Here is most of the article

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_18653&sliceId=2
cfform errors with ColdFusion MX on multihomed servers

Issue
When running ColdFusion MX in a multihomed environment,cfform may not work correctly. The symptoms can include:

JavaScript runtime errors
404 errors for the /CFIDE/scripts/cfform.js file
Required attribute validation does not occur
In ColdFusion 5, cfform generated inline JavaScript code to perform validation. In ColdFusion MX, that JavaScript is kept in a file instead and included where needed. The file, /CFIDE/scripts/cfform.js, may not be available in a hosted environment or if multiple websites have been defined on the server.


Solution
To resolve the issue, use one of the following solutions:

Put a copy of the cfform.js file into a directory in your webroot and use the scriptSrc attribute of thecfform tag to reference it.
<cfform
   scriptSrc=/mysite/scripts/cfform.js>
...</cfform>

Create a virtual directory within your website configuration to point to the /CFIDE/scripts directory under the default website.

Copy the /CFIDE/scripts directory into the webroot of the new site.

0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 19915030
Looks like it works in firefox... maybe it's an IE7 thing...give points to _agx_ if it works for you.

it doesn't say anything in the article about the ability in CF8 to specify a new folder name other than /cfide/scripts, which is a cool new feature for admins that like to obscure their directories.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 19915200
I tried it with IE6 so it may well be an IE7 problem.

> it doesn't say anything in the article about the ability in CF8  to specify a new folder name
> other than /cfide/scripts, which is a cool new feature for admins that like to obscure their directories

Yes, they need to update that technote.  That does sound like a neat feature.  I haven't used it.  What's the benefit in this case (ie with javascript files)?



0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 19915252
the benefit is that you can put all the scripts into any directory name you want then set the directory path in CFadminstrator instead of having to do:

<cfform
   scriptSrc=/mysite/scripts/cfform.js>
...</cfform>

everytime you use cfform in your application, also there a ton more tags that use the scripts directory now with all the ajax enhancements, so it would be a real pain if you had to set that scriptsrc variable with every cfmenu,cfform,cfdiv, etc tag in your code


0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 19915344
Also, to give you an idea of how much more CF8 uses the cfide/scripts folder:

In previous versions of CF the directory contains 2 files cfform.js and wddx.js

In CF8 the directory contains 1,887 files and 250 folders
0
 
LVL 52

Expert Comment

by:_agx_
ID: 19915494
> In CF8 the directory contains 1,887 files and 250 folders

Wow.  Now thats a huge increase.  

> it would be a real pain if you had to set that scriptsrc

True.  But even in MX7 you don't have to do that.  You could a) create a virtual directory within your website configuration to point to the /CFIDE/scripts directory under the default website or  b) copy /CFIDE/scripts to the webroot. Though copying 1887 files is certainly less attractive than copying 2 files.

The CF8 feature sounds like an improvement.  I'll have to play around with it more.

0
 
LVL 13

Expert Comment

by:srikanthmadishetti
ID: 19915602
wow some nice info reg cf8  
I was just checking watz new in cf8 document

and found this

If you specify the scriptsrc attribute in the cfform tag and are using Flash forms, you
must include the CF_RunActiveContent.js file in the directory you specified in the
scriptsrc attribute. You can copy this file from wwwroot/CFIDE/scripts/
CF_RunActiveContent.js.".
You only need it if:
" You override the default
" You are using Flash
0
 
LVL 14

Assisted Solution

by:Scott Bennett
Scott Bennett earned 800 total points
ID: 19915893
>True.  But even in MX7 you don't have to do that.  You could a) create a virtual directory within your
>website configuration to point to the /CFIDE/scripts directory under the default website or  b)
>copy /CFIDE/scripts to the webroot. Though copying 1887 files is certainly less attractive than copying
>2 files.

both of these options would still leave the directory to the scripts as being www.yoursite.com/cfide/scripts/cfform.js  if you want to get rid of the cfide and just use www.yoursite.com/myscripts/cfform.js then you would have to use the new cf8 administrator setting or use:
<cfform
   scriptSrc="/myscripts/cfform.js">
...</cfform>
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 1200 total points
ID: 19916475
> if you want to get rid of the cfide and just use www.yoursite.com/myscripts/cfform.js 
> then you would have to use the new cf8 administrator setting
Ahh.  That's they key part.  Cool.  Learn something new every day.

http://livedocs.adobe.com/coldfusion/8/htmldocs/ajaxdata_08.html#1127099
0
 

Author Comment

by:Nigel-SA
ID: 19918051
Wow you are guys are amazing - thanks
Yes it now works, removed cfide directory added  www.yoursite.com/myscripts/cfform.js with
<cfform
   scriptSrc="/myscripts/cfform.js">
...</cfform>
 One problem it works fine on the web - that's good, but now development on local drive now gives same error web had - no prompt concerning unchecked boxes.  Any suggestion to fix? if not I can live with it, thanks again
0
 
LVL 52

Expert Comment

by:_agx_
ID: 19918122
Did you make the same change to development on the local drive?

>  removed cfide directory ...
>  <cfform
>   scriptSrc="/myscripts/cfform.js">
>...</cfform>

To clarify, its not _required_ that you remove the CFIDE directory.  You could simply copy the /cfide/scripts directory into www.yoursite.com/cfide/scripts/.  Then you could use cfform without having to specify the  "scriptSrc" every time you use cfform.

   <cfform>
   ... form fields ...
   </cfform>

If for some reason you prefer to keep your scripts in the "/myscripts" directory instead,  you can change the default location in the ColdFusion 8 Administrator as SBennett mentioned.   (Assuming you have access to it) Changing the default location should also allow you to use cfform without specifying the "scriptSrc"

 ColdFusion Administrator > Server Settings > Settings page, Default CFFORM ScriptSrc Directory field.


0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question