• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 741
  • Last Modified:

Coldfusion client side FORM validation not working

For the life of me I can't figure out why my CF client side form validation isn't working.  With the attached script, no error messages pop up if the form is submitted without data.  What am I doing wrong???
<cfform action="test.cfm">
 
First Name: 
<cfinput name="firstname" type="text" maxlength="70" required="yes" message="Please Enter your First Name" validateAt="onSubmit"/><br />
 
Last Name:
<cfinput name="lastname" type="text" maxlength="70" required="yes" message="Please Enter your Last Name" validateAt="onSubmit"/><br />
 
<cfinput type="submit" name="Submit" value="Submit" />
 
</cfform>

Open in new window

0
slick_moe
Asked:
slick_moe
  • 4
  • 2
1 Solution
 
_agx_Commented:
A common cause is that the cfform.js file cannot be found in the expected location.  CF uses javascript files to perform validation.  If the files do not exist in the expected location

http://www.yoursite.com/CFIDE/scripts/cfform.js

.. the validation will not work.  Try the above url. Replace www.yoursite.com with your root website address.  If you get an HTTP 404 error (file not found) that is your problem.

Per an adobe technote there are (3) ways to solve this problem:
http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_18653&sliceId=2

1) Put a copy of the cfform.js file into a directory in your webroot and use the scriptSrc attribute of thecfform tag to reference it.

      <cfform
         scriptSrc=/mysite/scripts/cfform.js>
      ...</cfform>

2) Create a virtual directory within your website configuration to point to the /CFIDE/scripts directory under the default website.

3)  Copy the /CFIDE/scripts directory into the webroot of the new site.
0
 
slick_moeAuthor Commented:
I tried locating the cfform.js file like you specified (http://www.yoursite.com/CFIDE/scripts/cfform.js) - with my URL instead - and I did get the 404 error.

But, to complicate things, I just noticed that the client side validation DOES work in firefox, but not in IE7.  Seems that if firefox is finding the .js IE7 would to.  What do you think?
0
 
_agx_Commented:
I don't see how it could work at all the file does not exist.  Check the url I typed, make sure there are no typos.  

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
_agx_Commented:
> at all the file does not exist.

... at all IF the file does not exist.
0
 
_agx_Commented:
I tested the code and it works for me with IE 6 and firefox.  That suggests to me either a problem with missing files or a problem with IE7.  I lean towards missing files simply because that is most common problem.  But I suppose it could be a problem with IE 7.

0
 
slick_moeAuthor Commented:
Well, I created a virtual directory to CFIDE as you specified above and it solved the problem in IE7.  Problem solved, but it's still strange to me the FF worked without the virtual directory.  I guess I'll just be content knowing that it works now.

Excellent help, thanks!!!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now