<%= collection_select :node, :id, Node.find(:all,:order=>'name'), :id,
:name,{:prompt => 'Select Node' },{ :onchange => remote_function(:url =>
{ :action => "shownodecarddata"}, :with => "'id=' + $('node_id').value"
) } %>
Render your select boxes with a partial showing the data.
ct9a wrote:
> 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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---