Jump to content

Max size of dropdown box?


erdomester

Recommended Posts

no, I think he is still wanting it to only display 1 value at a time, but the entire list only be 10 items. By using size=X it will just change the number of entries that are visible at a time

 

the only question here is why limit to 10 possible choices if he is already putting 16+ choices into the list

This is a simple html code, I am sorry i didn't pay attention..

 

something like this:

echo '<select name="hour">';

for ($i=0; $i<24; $i++) 

{

  if ($i < 10)

  {

      $i = "0".$i;

  }

  echo "<option value='$i'>".$i."<?/option>";

}

echo '</select>';

 

 

Yeah, sg like the size operator, looking for a maxsize or sg, but havent found anything and begin to think that there no html solution for this...

if this is your exact code then I am even more confused.

 

1) you say that it only displays 16 items .. in both IE and Firefox I see all 24 items

2) you say you only want it to show 10 items.... Why?  You built your for loops to display all 24 items (hours ?).  If you only want to show 10 then limit your for loop to whatever hours you want

 

Can you try to provide exact details about what you are trying to accomplish here ?

Wow, I think there is a LOT of confusion in this post. I *think* I understand the OP request, let me restate for clarity.

 

The OP has a select list with 190 items in it. He only wants the user to select ONE item. However, when the user selects the drop-down arrow, the slect list expands into a scrolling list. That expanded list is big enough for 16 items to be viewable at a time. The OP would like that expanded list to only be big enough to have 10 items visibile at a time.

 

I agree with Axeia above, I don't think it is possible. The length of the expanded box is controlled by the BROWSER. I did a test and it is different in IE & FF. I think the only way you can do what you want is by creting a JavaScript select list.

I agree with Axeia above, I don't think it is possible.

 

I disagree. If all you're looking to do is alter the number of elements you can see at one time, the size attribute is what you need.

 

The size attribute will make the select list "fixed" to that size. The OP wants a standard drop-down with only one item visible with an expander button and when expanded is only X items high.

 

I'm still confused, but try this:

echo '<select onfocus="this.size=2" onblur="this.size=null" name="hour">'; 

 

Very counter intuitive to use though.

 

Ah, that's a good idea. I was going to advise against a custom select list, but that will work even for someone without JS.

I'm still confused, but try this:

echo '<select onfocus="this.size=2" onblur="this.size=null" name="hour">'; 

 

When I expand the ddbox, the whole webpage makes a jump then the ddbox becomes a fixed listbox. So when I want to use other ddboxes on the page, that one remains a listbox.

But that is a great start:)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.