Submit a form from RJS


#1

I am submitting an Ajax form with form_remote_tag

in my view
<% form_remote_tag( :url =>{:action => ‘list’}, :html => {:id =>
‘prop_search_form’, :name => “prop_search_form”} ) do %>

<% end %>

in my controller I test the request, to display a partial
def list

if request.xhr?
render :partial => ‘result_area’, :layout => false
end
end

now on a specific condition, I need to modify some form values (hidden
and radio), then I would like to submit the form… if a use page <<
"$(‘prop_search_form’).submit(), I don’t have an ajax request … and if
I try the following, I don’t catch the form parameters… what could
be the solution ?

def show_my_posts
render :update do |page|
page << “$(‘current_user_posts’).value = ‘1’”
page << “$(‘pt0’).checked = ‘true’”
page.redirect_to :action => ‘list’, :with =>
“Form.serialize(‘prop_search_form’)+’&=’”
end
end