Forum: Ruby on Rails submit a form from RJS

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ee0293412faca21e4ebf3326ed9d5f8c?d=identicon&s=25 Kad Kerforn (kadoudal)
on 2007-05-03 09:33
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
This topic is locked and can not be replied to.