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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop Downs and databases

Status
Not open for further replies.

jazzsax

Programmer
Oct 18, 2002
13
US
HI,

I'm trying to solve something that seems like it should be ridiculously easy. I want to display a drop down on an update form that shows the value currently in that field for that row as "selected" along the other options available. I looked at past threads and tried this code, but it didn't work for some reason. It looks good to me, but can't figure out why it's not working.


<select name = &quot;select&quot;>
<option value = &quot;value1&quot; <% if rs.(&quot;fieldname&quot;)= &quot;value1&quot; then resonse.write(&quot; selected&quot;) %>>value1
<option value = &quot;value2&quot; <% if rs.(&quot;fieldname&quot;)= &quot;value2&quot; then resonse.write(&quot; selected&quot;) %>>value2
<option value = &quot;value3&quot; <% if rs.(&quot;fieldname&quot;)= &quot;value3&quot; then resonse.write(&quot; selected&quot;) %>>value3
</select>

Any suggestions would be appreciated.

Thanks,

Jason
Austin Texas
 
Oh...I know the correct value is being captured from the record set, but it's the conditional statements are just being ignored so that the drop down rendered in html does not have a &quot;selected&quot; value.
 
well the if...END IF is not formed correctly

<option value = &quot;value1&quot; <% if rs.(&quot;fieldname&quot;)= &quot;value1&quot; then resonse.write(&quot; selected&quot;) [red]end if[/red] %>>value1

Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
the code looks right, but u misspelled the word &quot;response&quot;
 
That looks good to me too, but still no go. Thanks though.
Jason
 
Thanks for all the helpful suggestions...I was looking at too much last week. Some stuff I that didn't seem to be working had to do with nulls versus blank spaces in the db table...
 
Did that resolve your issue than?

Note on earlier post: Single line if statements do not require an accomanying End If statement. Thus this:
Code:
If true then Response.Write &quot;Yes it's true&quot;
is a valid statement. Attempting to tack an else onto the next line will result in an invalid statement however.

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
No more vacation for me :(

FAQ FAQ20-2863
= new Forums.Posting.General.GettingAnswers()
 
Yes...for some reason, it didn't work last week and I have no idea why (must have been a caching problem or something), but it works today so that's what counts. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top