Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy question? 1

Status
Not open for further replies.

MTBChik

Technical User
Jun 19, 2001
58
US
It's been awhile since I've coded an .asp and now I'm in the midst of one, so forgive me if this is a simple question...

I have an input page where the user can select several items which changes the sql query to the database. Basically if the user enters info in a text box, I want the default value in a drop down list to be "All" which is one of the options.

Here's what I've got so far (with out the monster query...)

If trim(request.form(&quot;edtCode&quot;))<>&quot;&quot; Then
response.write request.form(&quot;selMonth&quot;) = &quot;All&quot;
sqlStr = sqlStr & &quot;and event.event_code = '&quot; & request.form(&quot;edtCode&quot;)&&quot;'&quot;
End If

The error I'm getting is an expected close parenthesis ) in front of the &quot;All&quot;. Without this line, it works fine, except that the user must select a month and I don't want them to have to do that.

Hope someone can help me out.



 
If trim(request.form(&quot;edtCode&quot;))<>&quot;&quot; Then
request.form(&quot;selMonth&quot;) = &quot;All&quot;
response.write request.form(&quot;selMonth&quot;)
sqlStr = sqlStr & &quot;and event.event_code = '&quot; & request.form(&quot;edtCode&quot;)&&quot;'&quot;
End If
 
I gave that a shot and got this error:

Object doesn't support this property or method: 'Request.Form'

It points at the
request.form(&quot;selMonth&quot;) = &quot;All&quot;
line of code.

I am soooo bummed because I tried to do exactly what you gave me except in one line and that wasn't working.

Anything else??
 
Drop the request.form() bit and just assign the value to a variable:
If trim(request.form(&quot;edtCode&quot;))<>&quot;&quot; Then
selMonth = &quot;All&quot;
response.write selMonth
sqlStr = sqlStr & &quot;and event.event_code = '&quot; & request.form(&quot;edtCode&quot;)&&quot;'&quot;
End If

Why do you even need the request.form value if you're going to discard it anyway?
 
Thanks Veep!

I think I got it. I had to tweak my selMonth test to include it as part of an elseif in this condition, but now it's working just fine.
 
Request collection as Server collection are read only, that means you cant assign values to them only read from them.

request.form(&quot;selMonth&quot;) = &quot;All&quot; it's not posible.

________
George, M
 
That's kinda what happens when I start typing without thinking...doh! [hammer]
 
Hapens to me also when i got other things in my mind.

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top