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!

Beginner needs help, Drop down came out a list.

Status
Not open for further replies.

haneen97

Programmer
Dec 10, 2002
280
US
I was trying to build this as a drop down box; it came as a selection list. Can you please tell me what do I need to change to make it a drop down?

<td><form action="" method="post" name="form2">
Medicine 1 :
<select name="select1" size="8">>
<%
If NOT RsList.EOF Then
While NOT RsList.EOF
%>
<option value='<%= RsList.Fields("Product_Name").Value%>'><%= RsList.Fields("Product_Name").Value%></option>
<%
RsList.MoveNext
Wend
End If
%>
</select>
</form></td>


Thanks

Mo
 
change this
<select name="select1" size="8">>

to

<select name="select1" size="1">

-DNG
 
Thanks DNG,
That did the trick. I thought the size property sets the max number of elements in the drop down.

Thanks again

Mo
 
How can you control the number of elements show on the list by the way? I am trying to limit the drop down to 8 so if the table has 1000 items, the list wont show 1000 item.s

Thanks

Mo
 
so do you want to show the first 8 items..or what actually you want to do?

What if i want to select something and is not in the first 8 items...

let us know what your actual requierments are?

Thanks

-DNG
 
Just put a little counter inside your loop that you increment each time you write an <option>

Then add a contion to your loop like this:
While (NOT RsList.EOF) AND (myCounter <= 8)

Or you can use an IF statment inside the loop and exit out once you pass 8.
 
Sorry for not explaining my self well. I would like the entire list to query. But would like to view only 8 with a drop down that has a scroll bor for the user to scroll down for more.

I hope I am making sense.

Mo
 
Ohhh you want the height of the box to be such that 8 are shown but then, to see the rest of them, the user has to scroll down. Is that right?
 
then i guess you were correct to begin with...change the size back to 8. This will give you a list box instead of a dropdown...because you want the user to see first 8 and then scroll for more..

is that right?? or am i missing something...

-DNG
 
Hi,
The size= part controls how many lines are displayed in the select list..If there are more than that # returned by the RS, there will be a slider bar to scoll down to choose from the others..

( If you want to allow multiple selections add the MULTIPLE keyword to the select line like:

<select name="select1" size="14" MULTIPLE>

This will show up to 14 lines of values( and provide a slider to see more) and allow you to Shift/Cntrl click to pick more than one..)

[profile]
 
You are right, but I think the drop down is better because it does not take space on the screen. I think the list may take a scroll down bar if it got too long. I am looking at an old program that is doing the same thing and it is not doing anything special.

Thanks for your help

Mo
 
So you want a drop down that only displays one record before expanded. Then upon expansion, you want it to show 8 at a time with a scrollbar to see all of the records.

Is there a way to do this? All of my drop-downs expand to however much room there is in the browser window but it might be simple for all I know. Just haven't seen it.
 
you would have to have div then set the style to max-height:200px (or whatever height you want)

populate a table or list inside the div
 
Hi Steve,
Thanks for following up. I left it as a drop down for now. I have another big fish to fry for now. I am working on passing parameters between forms.

Thanks everybody. I'll post new threads if I have other questions.

Mo
 
glad it worked out for you.

You have a question with passing parameters - post it we're ready for a challenge.


head.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top