I want to load a form when a “select form” is changed. I have done this
but it doesn’t work( i do not have an error but nothing change when i
change the select list):
in the view:
<% form_tag :action => ‘update’, :id => @cour do %>
Choissisez le type de votre
article:
<%= select :cour, :type_article, {"cours"=>"c",
"exercice"=>"ex"},:include_blank=>true %>
<%= observe_field ‘type_article’,
:update => “formulaire”,
:url=>{:action=>‘generation_form’},
:with=>"‘type_article=’ + escape(value)",
%>
<%= submit_tag ‘Edit’ %>
<% end %>
In the controller:
def generation_form
type_article = params[:type_article]
if type_article == “ex”
render :partial => “formex”
else
render :partial => “formart”
end
end
the partial _formex:
(formualaire exo)
Contenu
<%= text_area 'cour', 'content' %>
thanks