# AJAX - how to have multiple select form sets implemented?

**URL:** <https://www.ruby-forum.com/t/ajax-how-to-have-multiple-select-form-sets-implemented/197006>\
**Category:** Rails\
**Created:** [October 16, 2009, 9:44am UTC](https://www.ruby-forum.com/t/ajax-how-to-have-multiple-select-form-sets-implemented/197006 "2009-10-16T09:44:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ct9a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ad7895/32.png) [@ct9a](https://www.ruby-forum.com/u/ct9a)\
**Post date:** [October 16, 2009, 9:44am UTC](https://www.ruby-forum.com/t/ajax-how-to-have-multiple-select-form-sets-implemented/197006/1 "2009-10-16T09:44:24Z")

</div>

hi, there 🙂

Consider a blogging application whereby a user is trying to add a new  
blog.

He/she has to select a category. Upon selecting a category from a drop  
down box, a new sub categories drop down box will be created (hence an  
AJAX call). Got this implemented and it’s ok.

Now, let’s assume that a given blog can have multiple categories (and  
subcategories).  
For example, a blog on a restaurant review can belong to the following  
categories & subcategories:

1. “food” -\> “fine dining”
2. “people” -\> “lifestyle”
3. “travelling” -\> “restaurants”

After selecting a set of category and sub category, there will be a  
link entitled, “add another category/subcategory” (I guess this can be  
done with link\_to\_remote or something).

My question is, how do you code it such that upon clicking on the link  
mentioned, another category drop down box will be displayed in the  
form. Selecting a category value would then cause a sub categories  
drop down box to appear in the same form allowing the user to select  
another sub category. Again, the link entitled, “add another category/  
subcategory” will also be shown.

How do I go abouts implementing this? I know it’s a call to use AJAX  
but I don’t exactly know how. I have tried reading up some rails books  
and cookbooks to no success.

Please help!! 🙂

thanks
