Observer_field - select form

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”,
: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”
render :partial => “formart”

the partial _formex:
(formualaire exo)

<%= text_area 'cour', 'content' %>


I found my mistake: wrong name of field.
=> <%= observe_field ‘cour_type_article’, instead of <%= observe_field

But I still have two problems with the result:
-The form is updated when the mouse is over a type of document and would
like to updated it when the user clic on the field.
-Without AJAX in “edit mode” the field were filled by the data already
saved. Now the fields are blank when the form is updated by AJAX.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs