# Problem with an AJAX drop-down menu

**URL:** <https://www.ruby-forum.com/t/problem-with-an-ajax-drop-down-menu/87801>\
**Category:** Rails\
**Created:** [March 27, 2006, 7:08pm UTC](https://www.ruby-forum.com/t/problem-with-an-ajax-drop-down-menu/87801 "2006-03-27T19:08:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![foxxbat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/85f322/32.png) [@foxxbat](https://www.ruby-forum.com/u/foxxbat)\
**Post date:** [March 27, 2006, 7:08pm UTC](https://www.ruby-forum.com/t/problem-with-an-ajax-drop-down-menu/87801/1 "2006-03-27T19:08:28Z")

</div>

Hi everyone,

I’m currently playing with ruby on rails, and I was trying to build a  
form with limited AJAX functionalities…

So here is my problem : I want to create a form in order to allow  
visitors to choose a car make and a car model. Once the user has choosen  
his make in a select tag, the model select tag is supposed to be updated  
with the models that belong to the choosen make (using an AJAX  
observer).

The problem is that the model menu is updated (i use a partial to fill  
the select tag with s), but the html tags are missing, and the  
models aren’t selectable, nor are they separated since they’re not  
included between and .

I tried to replace the drop-down menu with a simple unordered list  
(

), updated and filled with - tags… and it works. Is there  
something special about form tags?

Sorry if this isn’t clear, i haven’t practised my English for a while…

Thanks for your attention,

foxxbat

---

<div class="post-metadata">

**Author:** ![foxxbat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/85f322/32.png) [@foxxbat](https://www.ruby-forum.com/u/foxxbat)\
**Post date:** [March 27, 2006, 7:29pm UTC](https://www.ruby-forum.com/t/problem-with-an-ajax-drop-down-menu/87801/2 "2006-03-27T19:29:16Z")

</div>

You can’t use plain HTML to update a . You have to use  
the API of the select element, or you might have luck replacing the  
_entire_  
select element (not just the options) with your partial.

So, yes, is special.

-Thomas

Am 27.03.2006 um 19:08 schrieb foxxbat:

---

<div class="post-metadata">

**Author:** ![foxxbat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/85f322/32.png) [@foxxbat](https://www.ruby-forum.com/u/foxxbat)\
**Post date:** [March 27, 2006, 8:09pm UTC](https://www.ruby-forum.com/t/problem-with-an-ajax-drop-down-menu/87801/3 "2006-03-27T20:09:10Z")

</div>

Thomas F. wrote:

> You can’t use plain HTML to update a . You have to use  
> the API of the select element, or you might have luck replacing the  
> _entire_  
> select element (not just the options) with your partial.
> 
> So, yes, is special.
> 
> -Thomas
> 
> Am 27.03.2006 um 19:08 schrieb foxxbat:

Thanks a lot for the help. I have the same problem with the select API,  
but it seems to work fine if i replace the entire select element.

foxxbat
