Jump to content

Max size of dropdown box?


erdomester

Recommended Posts

a dropdown box to select a single element at a time, or a select multiple box ?

 

You populate the box with however many elements you want, so why dont you just limit the number of options you put into the box rather than trying to limit the number it displays ?

Link to comment
Share on other sites

Single select.

I dont get what you are saying. I have 190 elements in the dropdown box and when I click on the arrow (like here in the "Message icon" row: Standard), it "drops down" 16 elements. This is too many for me as I have not so much place on the website.

Link to comment
Share on other sites

So basically what you are saying is that you have 190 elements available to select, the dropdown only shows 16 of them, and you want to only display 10 of them?

 

How would you choose which 10 to select ? can you post the code of how you are generating this dropdown

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.