# Need a dropdown having "more.." option

**URL:** <https://www.ruby-forum.com/t/need-a-dropdown-having-more-option/186640>\
**Category:** Rails\
**Created:** [April 10, 2010, 10:49am UTC](https://www.ruby-forum.com/t/need-a-dropdown-having-more-option/186640 "2010-04-10T10:49:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![samiron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ac91a4/32.png) [@samiron](https://www.ruby-forum.com/u/samiron)\
**Post date:** [April 10, 2010, 10:49am UTC](https://www.ruby-forum.com/t/need-a-dropdown-having-more-option/186640/1 "2010-04-10T10:49:05Z")

</div>

I have a collection of products that I am showing in a dropdown. Now  
at the first view it will show only first 10 products in the dropdown  
with an option “more…” at last. if user clicks the “more…” he can  
see all the following products in that dropdown list (this is not any  
ajax request, just javascript show/hide). Of course the more… option  
will hide when showing all items.

Any suggestion for it? My select tag have a “onchange” which submits  
the form and hence showing that product description.

I cant find out the exact way to do this. Please help

---

<div class="post-metadata">

**Author:** ![samiron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ac91a4/32.png) [@samiron](https://www.ruby-forum.com/u/samiron)\
**Post date:** [April 12, 2010, 2:18pm UTC](https://www.ruby-forum.com/t/need-a-dropdown-having-more-option/186640/2 "2010-04-12T14:18:38Z")

</div>

On 10 April 2010 09:47, Samiron [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have a collection of products that I am showing in a dropdown. Now  
> at the first view it will show only first 10 products in the dropdown  
> with an option “more…” at last. if user clicks the “more…” he can  
> see all the following products in that dropdown list (this is not any  
> ajax request, just javascript show/hide). Of course the more… option  
> will hide when showing all items.

I don’t know your reasoning for doing this, but assuming it’s to make  
the UI  
a bit cleaner (rather than the fact that the list is HUGE, in which case  
searching would be a better UI option anyway) I’d personally do this  
with  
jQuery rather than Rails/Ajax. If you’re using Prototype you’ll need  
someone who knows that framework to translate this jQuery code.

I’ve tested the code below in Safari and it works fine, you may need to  
tweak it for your needs though…

Cheers,

Andy

Test option enabling

Option 1 Option 2 Option 3 Option 4 Option 5 Option 6 Option 7 Option 8 Option 9 Option 10 Option 11 Option 12 Option 13 Option 14 Option 15 Option 16 Option 17 Option 18 Option 19 Option 20

---

<div class="post-metadata">

**Author:** ![samiron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ac91a4/32.png) [@samiron](https://www.ruby-forum.com/u/samiron)\
**Post date:** [April 12, 2010, 4:28pm UTC](https://www.ruby-forum.com/t/need-a-dropdown-having-more-option/186640/3 "2010-04-12T16:28:03Z")

</div>

You could always just render the output the results to the screen and  
not mess with the drop down. That would be much easier, then you  
could just have a “more” button at the bottom like twitter does.
