Solved

cfform not validating required fields.

Posted on 2007-03-21
7
964 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
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:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

815 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

10 Experts available now in Live!

Get 1:1 Help Now