Solved

cfform not validating required fields.

Posted on 2007-03-21
7
961 Views
Last Modified: 2008-01-09
I am using <cfform> and have certain fields that are required using <cfinput>. The require fields prompt is not coming up and I am getting errors when I submit the form. I have the cfform.js file on the server and have mapped to it correctly. I also tried adding scriptSrc="/includes/cfform.js" to the opening <cfform> and the result was the same. The form is located at http://strategicequityreport.com/debt-equity-goals-survey.cfm. It is the large form, not the little on on the side.

I have the following in the head tag:

<script type="text/javascript" src="/includes/cfform.js"></script>

A snippet of the form is:

 <cfform name="survey" action="/survey2.cfm" method="post">
 <cfinput type="text" name="EmailAddress" size="30" message="Please enter an email address" validate="email" required="yes">
<cfinput type="submit" name="Submit" value="Submit" />
</cfform>

0
Comment
Question by:semerj
  • 4
  • 2
7 Comments
 
LVL 36

Expert Comment

by:SidFishes
ID: 18768500
I never use cfform but...

the js code is erroring on

if (obj.value.length == 0)

which means the js is running..there's just a problem

so there's something with your cfform can't say for sure given the code you've posted but looks like you're not validating some thing or have something misnamed maybe??

0
 

Author Comment

by:semerj
ID: 18774715
Actually, I think that error is stemming from the emailaddress field being left blank and going through to the action page. The <cfmail> has a null attribute for the from address because the js did not catch it on the previous page.  If the js were running, it would not get to that point.
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 18776543
no ..the js on that page IS running ...I've set firebug to break on JS errors and it does error on the page before the submit....using this debug method, i don't even get to the form submit...if i run after the break then I get the cf error

something else is going on...

0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:semerj
ID: 18777390
ok. I see that now on line 62 of the Js file. Shall I paste the entire form code? It is kinda long.
0
 

Author Comment

by:semerj
ID: 18779251
upon further investigation, forms on my server that were validation just fine using the cfform.js are not anymore.
0
 
LVL 4

Accepted Solution

by:
mackaboogie earned 500 total points
ID: 18781502
Your devnet version of CF is placing invalid JS src links in your code.
<script type="text/javascript" src="C:\Inetpub\vhosts\aidcdemos.com\httpdocs\CFIDE\scripts/cfform.js"></script>
<script type="text/javascript" src="C:\Inetpub\vhosts\aidcdemos.com\httpdocs\CFIDE\scripts/masks.js"></script>

These should read:
<script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>

You need to remove the additional link you placed to cfform.js higher up the page as well.
0
 

Author Comment

by:semerj
ID: 18788094
I am in the process of migrating everything to a new server and will try this as soon as it is set up.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

896 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now