|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#16
|
|||
|
|||
|
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 |
|
#17
|
|||
|
|||
|
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. ![]() |
|
#18
|
|||
|
|||
|
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> |
|
#19
|
|||
|
|||
|
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 ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > search form returns all with no term specified |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|