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:
  #16  
Old September 10th, 2004, 10:19 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 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 14 h 23 m 22 sec
Reputation Power: 53
The problem is that you are trying to output your error message right in the middle of your cfquery block. This won't work as you have seen.

What you need to do is to a test before the WHOLE cfquery, like this in pseudocode...

<cfif len(trim(FORM.Job_Number)) or len(trim(FORM.startDate)) or len(trim(FORM.querystring1)) or len(trim(FORM.querystring2))>
...at least one of those has something in it so run the <cfquery>...</cfquery>
<cfelse>
....here's the error message...
</cfif>

So take out the inner <cfelse> block with your message in it and handle that by wrapping a condition around the whole query.
__________________
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
  #17  
Old September 10th, 2004, 11:03 AM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
Hi kiteless,

I tried that somewhere around post #5 but am now getting the same error message I posted there :

Attribute validation error for tag cfoutput.
The value of the attribute query, which is currently "q_queryResults", is invalid.


which makes sense because the user didn't enter anything into the search fields.

There is something I am just not understanding about how CF is handling this. It is reading and printing my cfelse statement but still giving me the error message.
Attached Files
File Type: zip queryResults2.zip (1.4 KB, 124 views)

Reply With Quote
  #18  
Old September 10th, 2004, 12:10 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 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 14 h 23 m 22 sec
Reputation Power: 53
No that's right. It just means you also need to wrap a cfif around your output, something like this.

<cfif isDefined( 'q_queryResults' )>
<cfoutput query="q_queryResults">
....
</cfoutput>
<cfelse>
You must enter some values for search terms...
</cfif>

Reply With Quote
  #19  
Old September 10th, 2004, 12:38 PM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
SUCCESS!

Oh my, I think the order of ifs and elses and trying to figure out what has to be a nested if and what can be part of a big 'ol if is really going to kill me.

Don't know if you noticed but I also had an if in there that said if the search produced no records then output a statement about it. That little if statement was messing me up big time with this other thing.

Thanks for setting me straight as always! You are a tremendous asset to this forum!

cheers,
melissa

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > search form returns all with no term specified


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 1 hosted by Hostway