ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old July 30th, 2004, 11:09 AM
ceb39 ceb39 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 2 ceb39 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Date Validation?

I am developing a Cold Fusion form which allows users to input data into an Access table. While testing this form I put a date in a date field of 22/11/2004. This error was caught on the server side with a cryptic message indicating the date was incorrect.

To avoid that kind of cryptic message for a user I decided to try and catch this type of error on the client side. Now the line used to input the date looks like this:

<td width="25%" align="center"><cfinput type="Text" name="src_DateAdded" size="12" required="Yes" validate="date" message="Date Format Is mm/dd/yyyy">&nbsp;MM/DD/YYYY&nbsp;</td>

Now I have two problems - 1. An incorrect date is still generating a server side error message (but not as cryptic now); 2. If nothing is entered into the date text field no error message is shown, i.e. the data in the form is processed into the Access table.

Is there something I missed in trying to valid the date entry?

At the bottom of the form I have the following line:

<td width="25%" align="center"><input type="button" value="Add SRC Record" onclick = "return checkForm(this)"></td>

The checkForm() function is being used to validate two text fields and a set of radio buttons, but no date validation takes place in checkForm(). Once checkForm() is completed data is processed into the Access table.

In using checkForm() have I bypassed the validation routine called out in the INPUT line? Any way to use CF's validation routines to check for a correct date and avoid going through some type of javascript routine?

Thanks

Chuck

Reply With Quote
  #2  
Old July 30th, 2004, 12:05 PM
bfolger71 bfolger71 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Boston, MA
Posts: 47 bfolger71 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 34 sec
Reputation Power: 5
One thing I might recommend is to use either <cfinput> *OR* do an onSubmit validation function, but not both. Even though it may work fine, it just complicates things. As you likely know, all the CF validation is doing is generating javascript validation anyway.

Relating to problem 2, try putting the return in an onSubmit within the form tag instead:

<form name="whatever" action="whatever" onSubmit="return checkForm(this)">

Reply With Quote
  #3  
Old July 30th, 2004, 01:00 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
<cfinput> will also allow you to specify validation script or regular expressions to validate against.

That said, I would just do this with Javascript if you require more than what the built-in validation gives you. There are thousands of free validation Javascripts out there.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #4  
Old October 4th, 2004, 03:59 PM
ceb39 ceb39 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 2 ceb39 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Position of "onSubmit function

What is the advantage of placing the checkForm(this) function in the <FORM> line vice having it <INPUT TYPE> line where I have it now?

ceb39

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Date Validation?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway