Coldfusion V9 Form Error

FormEntry ErrorServer Settings Page 1Server Settings Page 2Hi,
I am running Coldfusion v9 (migrated from Coldfusion v7) and running on error on the same cfm page that used to run just fine in CF7 environment.
I found an article where they talk about this type of error and apparently one person in that discussion pointed out that we can turn this feature off.
Here is the link:
https://www.bennadel.com/blog/767-new-coldfusion-error-form-entries-incomplete-or-invalid.htm

However it does not say exactly what feature/function to turn off in CF admin.

Can you help?
LVL 1
sgleeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

_agx_Commented:
I looked around in CF11 but didn't see anything in the Admin that looked relevant.  They did add a new application level setting (requires an Application.cfc)



CF9+ - Application.cfc

this.serverSideFormValidation="false";

Open in new window


http://www.raymondcamden.com/index.cfm/2009/7/12/My-first-ColdFusion-9-scoop--disable-server-side-validation

CF8 - Application.cfc

<cfset this.name = "myApplication">
<cfset url.form = structnew()/>
<cfset structappend(url.form,form)/>
<cfset structclear(form)/>
<cffunction name="onRequestStart">
    <cfset structappend(form,url.form)/>
    <cfset structdelete(url,"form")/>
</cffunction>

Open in new window


http://www.cfinsider.com/index.cfm/2008/9/30/Getting-Around-ColdFusion-Form-Validation


Keep in mind there's also a bug report about the application level setting that was fixed in later versions. If it affects your app, you may want to rename the form fields instead.
https://tracker.adobe.com/#/view/cf-4170204

Server Side Hidden Field Validation Rules
0
sgleeAuthor Commented:
where (folder location) do I create CFC file and how do I reference it?
All my CFM website-related files are located off C:\inetpub\wwwroot. For example, Online Order CFM & HTML files are located in C:\inetpub\wwwroot\OnlineOrder folder.
Coldfusion is installed in C:\ColdFusion9 folder.
I also see C:\inetpub\wwwroot\cfdocs, C:\inetpub\wwwroot\CFIDE, C:\inetpub\wwwroot\aspnet_client folders.
0
_agx_Commented:
All my CFM website-related files are located off C:\inetpub\wwwroot

You can put it there, but all depends on the structure of your apps.  It acts just like an Application.cfm  file, only with more features. You don't need reference it. Like an Application.cfm file, it runs automatically whenever a .cfm/cfml script in that same directory (or subdirectories) is invoked.

Do your websites already use an Application.cfm? If yes, you'll need to convert them.  If you need help, just attach them here and I'd be happy to help.
0
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

sgleeAuthor Commented:
I have multiple sub-folders under C:\Webroot. Each sub-folder was created whenever I need to create a new website.
So by putting .CFC file in C:\Webroot, the code in .CFC file will be effective on all existing CFM files in sub-folders in C:\Webroot?
0
sgleeAuthor Commented:
"Do your websites already use an Application.cfm?" --> I see application.cfm file in virtually every sub-folder (which was created for each website).
0
_agx_Commented:
If you mean "C:\inetpub\wwwroot" yes -  unless the existing subfolders already contains an Application.cfm/cfc file.  

When you run a .cfm script, CF searches the current directory for an Application.cfc/cfm file. If it's found, CF stops looking and uses that one. Otherwise, it searches all parent directories until it finds one.  

For example, if you request page /siteB/pageB.cfm OR /siteA/pageB.cfm CF will use {root}/Application.cfc, because the "siteA" and "siteB" subfolders don't have an Application.cfm/cfc file.

C:\inetpub\wwwroot\Application.cfc
C:\inetpub\wwwroot\siteA\pageA.cfm
C:\inetpub\wwwroot\siteA\pageB.cfm
C:\inetpub\wwwroot\siteB\pageA.cfm
C:\inetpub\wwwroot\siteB\pageB.cfm

BUT ... say the "siteB" subfolder already contains an Application.cfm file:

C:\inetpub\wwwroot\Application.cfc
C:\inetpub\wwwroot\siteA\pageA.cfm
C:\inetpub\wwwroot\siteA\pageB.cfm
C:\inetpub\wwwroot\siteB\Application.cfm
C:\inetpub\wwwroot\siteB\pageA.cfm
C:\inetpub\wwwroot\siteB\pageB.cfm

* When you request page /siteB/pageA.cfm, CF will use siteB/Application.cfm - NOT /Application.cfc.
* When you request page /siteA/pageA.cfm, CF will use /Application.cfc - because the "siteA" folder doesn't contain an Application.cfm/cfc file
0
_agx_Commented:
Update: Fix broken link

I see application.cfm file in virtually every sub-folder (which was created for each website).

Then you'll either have to

1. Convert the Application.cfm files to Application.cfc and use the new setting
2. Convert theApplication.cfm files and try the CF8 workaround mentioned here https://web.archive.org/web/20111206102804/http://www.cfinsider.com/index.cfm/2008/9/30/Getting-Around-ColdFusion-Form-Validation
3. Rename the form fields
0
sgleeAuthor Commented:
1. I have all my website related files in C:\Webroot folder instead of C:\inetpub\wwwroot. Fyi it has been that way all these years in old Web server and I simply copied all the files to this new server and kept the same folder structure. Is it necessary to move them to C:\inetpub\wwwroot folder?
2. I misspoke about existence of application.cfm files in multiple website folders. Yes application.cfm files are there, but most websites have been migrated to web hosting companies and we only run two websites on this web server locally. When I look at the C:\Webroot\SiteA folder, I do not see application.cfm file. I must have not needed it. Having said that, can I just create a new file "application.cfc" in Notepad and add -this.serverSideFormValidation="false"  - and save the file?
0
_agx_Commented:
A) Can you post the Application.cfm files for the two sites (minus any confidential info)?
B)  "can I just create a new file "application.cfc" in Notepad and add -this.serverSideFormValidation="false""
No, it needs a few more properties minimum - like application "name", enabling session management (if your app uses session variables), etc...  That's why it'd help to see the existing Application.cfm files.
C) Which directory is your web root, ie "/" - C:\inetpub\wwwroot or C:\Webroot\?
0
sgleeAuthor Commented:
A) There was not cfm file in the website that I am having this problem with. However I opened a few others and one of them looks like this:
-----------------------------------------------------------------------------------------
<HTML>
<HEAD>
<TITLE></TITLE>
<META name="description" content="">
<META name="keywords" content="">
<META name="generator" content="CuteHTML">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
<!--Don't forget to add your FREE HitBOX statistics to your web page. To
do so, click on Online Services\HitBox Statistics...-->
<CFAPPLICATION NAME="DSW"
SESSIONMANAGEMENT="Yes"
SESSIONTIMEOUT="#CreateTimeSpan(0, 0, 20, 0)#">
-----------------------------------------------------------------------------------------

Below is another CFM. This one handles login process.
-----------------------------------------------------------------------------------------
<cfapplication name="onlineorder" sessionmanagement="Yes" sessiontimeout="#CreateTimeSpan(0,4,0,0)#" setclientcookies="Yes">
<CFSET APPLICATION.FACE = "verdana,arial,helvetica">
<CFSET APPLICATION.HistoryHeaderBGColor = "435663">
<CFSET APPLICATION.HistoryFieldTitleBGColor = "D7D7D7">
<CFSET APPLICATION.HistoryFieldHeaderColor = "">
<CFSET APPLICATION.HistoryFieldTextBGColor = "">


      <!---Check to see if the session is valid, or its a login attempt--->
      <cfparam name="session.LoggedIn" default="false">  
      <cfif not isdefined("LoginAttempt")>
            <cfif session.LoggedIn is false and listlast(cgi.script_name,"/") neq "login.cfm">
            <cflocation url="login.cfm">
            </cfif>
      </cfif>

      <!--- initialize application variable if it doesn't exist yet --->
      <cfif NOT structKeyExists(Application, "UsersInfo")>
            <cflock timeout="15" scope="Application" type="exclusive">
               <cfif NOT structKeyExists(Application, "UsersInfo")>
                  <cfset Application.UsersInfo = StructNew()>
                </cfif>
            </cflock>
      </cfif>

      <!--- if this is a new user that IS logged in, save the login details --->
      <cflock timeout="15" scope="Application" type="exclusive">
            <cfif NOT StructKeyExists(Application.UsersInfo, COOKIE.CFID)
                  AND structKeyExists(session, "name")>
            <cfset newUser = structNew()>
            <cfset newUser.userTime  = now()>
            <cfset newUser.userName = session.name>
            <cfset Application.UsersInfo[COOKIE.CFID] = newUser>
             </cfif>
      </cflock>

      <!--- remove expired logins --->
      <cflock scope="Application" type="exclusive" timeout="15">
       <cfloop collection="#Application.UsersInfo#" item="userData">
              <cfif  DateDiff("n", Application.UsersInfo[userData].userTime, Now()) GT 10>
                <cfset StructDelete(Application.UsersInfo, userData)>
              </cfif>
          </cfloop>
      </cflock>
</BODY>
</HTML>
-----------------------------------------------------------------------------------------

For this webpage(where I get an error), I don't need "login process" application.cfm either. This page simply takes input on a blank form and stores the data in Access database.
So nothing to move over.
0
_agx_Commented:
So you don't need any of the login sections  OR you don't need the Application.cfm at all?  Reason I ask is the 2nd example also defines some application variables (application.FACE, etc...). Removing them might break other pages if they're used elsewhere in your code.
0
sgleeAuthor Commented:
"also defines some application variables (application.FACE, etc...)."  --> I see. Yes they are not important at all.

I forgot to answer one of your questions:
C) Which directory is your web root, ie "/" - C:\inetpub\wwwroot or C:\Webroot\? --> I created C:\webroot folder manually in my old web server and did the same thing on the new web server that I am working on. I think  C:\inetpub\wwwroot  was created as I installed IIS role in Server Manager.
0
_agx_Commented:
1. Okay, but what does "/" resolve to?  ie

<cfoutput>The web root is #ExpandPath("/")#</cfoutput>

2.  Is it okay for both sites to share the same settings (session timeout, application name, etc...)?
0
_agx_Commented:
If it's okay for both apps to share the same settings (application variables, session variables, timeouts, etc...) then create a single Application.cfc in the web root (ie whatever #ExpandPath("/")# resolves to)

Application.cfc
<!--- Change "YourApplicationName" to the desired name for your sites --->
<cfcomponent>
	<cfset this.Name = "YourApplicationName">
	<cfset this.sessionManagement = "yes">
	<cfset this.sessionTimeOut = CreateTimeSpan(0,4,0,0)>
	<cfset this.setClientCookies = "yes">
	<cfset this.serverSideFormValidation="true">
	
</cfcomponent>

Open in new window


If they should to have different settings, then create an Application.cfc file in each directory. Just be sure to use a different name for each site, . Otherwise, they'll still share the same application settings.  Example:

/siteA/Application.cfc
   <cfcomponent>
	<cfset this.Name = "SiteAApplicationName">
        .... more settings
   </cfcomponent>

Open in new window


/siteB/Application.cfc
   
<cfcomponent>
	<cfset this.Name = "SiteBApplicationName">
        .... more settings
   </cfcomponent>

Open in new window


Keep in mind any pages with a <cfapplication> will override the Application.cfc. So you should probably do a search for any other <cfapplication> tags and move any extra settings into Application.cfc, then remove the <cfapplication> tags.
0
sgleeAuthor Commented:
OK. I will try it and let you know if it takes care of the error.
0
_agx_Commented:
Oops, sorry.... I was testing the code and left the setting enabled / true.  It should be set to false. Here's the corrected version:

<!--- Change "YourApplicationName" to the desired name for your sites --->
<cfcomponent>
	<cfset this.Name = "YourApplicationName">
	<cfset this.sessionManagement = "yes">
	<cfset this.sessionTimeOut = CreateTimeSpan(0,4,0,0)>
	<cfset this.setClientCookies = "yes">
	<cfset this.serverSideFormValidation="true">
	
</cfcomponent>

Open in new window



Also, here's a test page.  The submit should succeed when this.serverSideFormValidation="false" and fail when it's omitted or this.serverSideFormValidation="true".

<cfif structKeyExists(FORM, "Start_Date")>
	Success <cfdump var="#FORM#">
</cfif>

<cfform method="post">
	StartDate: <input type="text" name="StartDate" value="ABC">
	<input type="hidden" name="StartDate_date">
	<input type="submit">
</cfform>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sgleeAuthor Commented:
<cfset this.serverSideFormValidation="true"> ---> should this set to "false"?
0
sgleeAuthor Commented:
Yes it worked. I changed to "false". Of course you knew that.

<cfcomponent>
      <cfset this.Name = "SANECK International">
      <cfset this.sessionManagement = "yes">
      <cfset this.sessionTimeOut = CreateTimeSpan(0,4,0,0)>
      <cfset this.setClientCookies = "yes">
      <cfset this.serverSideFormValidation="false">
</cfcomponent>

Thanks for your help and I appreciate it.
0
_agx_Commented:
Yep.  I accidentally left it turned on (from testing). Glad I could help.
0
sgleeAuthor Commented:
Thank you AGX.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.