Solved

cfform not validating required fields.

Posted on 2007-03-21
7
959 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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.

760 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

20 Experts available now in Live!

Get 1:1 Help Now