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:
<code><% form_tag :action => ''update'', :id =>
@cour do %>
<!-- we choose the type of document (which will determine the form to
include) -->
<p><label for="type_article">Choissisez le type de votre
article:</label><br/>
<%= select :cour, :type_article, {"cours"=>"c",
"exercice"=>"ex"},:include_blank=>true %>
<!-- we observe the select list -->
<%= observe_field ''type_article'',
:update => "formulaire",
:url=>{:action=>''generation_form''},
:with=>"''type_article='' +
escape(value)",
%>
<div id="formulaire">-</div>
<%= submit_tag ''Edit'' %>
<% end %></code>
In the controller:
<code>def generation_form
type_article = params[:type_article]
if type_article == "ex"
render :partial => "formex"
else
render :partial => "formart"
end
end</code>
the partial _formex:
<code>(formualaire exo)
<p><label
for="cour_content">Contenu</label><br/>
<%= text_area ''cour'', ''content''
%></p></code>
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---