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:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old August 3rd, 2004, 01:36 PM
jds361 jds361 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 29 jds361 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 41 m 37 sec
Reputation Power: 0
Negative Value in Range

I am working with a Coldfusion form and I want to validate a file with a negative and positive range. For example:

Code:
<cfinput range="-90, 90" validate="float" type="text" name="north" maxlength="40" value="">

But this generates the error:

Invalid number -90 in range expression!

Anyone have any workarounds to this problem?

Reply With Quote
  #2  
Old August 4th, 2004, 08:21 AM
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
Try it without a space after the comma between the 2 numbers. But if the range validation that's built in to CF won't take a negative number, then you'll need to write your own Javascript to do the validation.
__________________
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
  #3  
Old August 4th, 2004, 02:40 PM
jds361 jds361 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 29 jds361 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 41 m 37 sec
Reputation Power: 0
I ended up having to write my own validation here. You can see the answer below (in Javascript):

Code:
function validateForm () {
  for(i=0;i<document.forms[0].elements.length;++i) {
    var elem = document.forms[0].elements[i];
    if (elem.name == "my_field") {
      if((elem.value >= -90) && (elem.value <= 90)) { 
      }
      else {
        alert ("Please enter in a value between -90 and 90.");
        return false;
      }
    }
}
myform.submit();
}


Then in the form, I wrote:

Code:
<cfform action="get_data.cfm" onSubmit="validateForm(this.form);return false;">


And that seems to work well. Thanks for your help!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Negative Value in Range


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 | 
  
 

IBM developerWorks




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