Solved

cfform not validating required fields.

Posted on 2007-03-21
7
970 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to file 3 92
Adding a hidden div to each row in a table 6 97
Coldfusion / Railo 4 -  datetimeFormat problem 3 37
Coldfusion cfscript DELETE function 7 38
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

749 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