Forum: Ruby on Rails form_remote_tag not sending xml_http_request

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-02 12:25
I have a form defined in a view :

<% form_remote_tag( :url =>{:action => 'list' }, :html => {:id =>
'prop_search_form',  :name => "prop_search_form"}) do %>
....
<% end %>

when submitted, the check in list action of the controller  is not
performed

    if request.xml_http_request?
      render :partial => 'result_area', :layout => 'false'
    end

debugging gives :
request.xml_http_request?  => false

why ?

the html code generated seems to be correct :

<form action="/proposals/list/22218" id="prop_search_form" method="post"
name="prop_search_form" onsubmit="new
Ajax.Request('/proposals/list/22218', {asynchronous:true,
evalScripts:true, parameters:Form.serialize(this)}); return false;">

where am I wrong ?

thanks for your help
Af9a9013100ddf2dbb0ca13487b60f8b?d=identicon&s=25 Ivor Paul (Guest)
on 2007-05-02 12:45
(Received via mailing list)
for one - you are looking for request.xhr instead of
request.xml_http_request? see page 542 of the agile web development
book.
Ee0293412faca21e4ebf3326ed9d5f8c?d=identicon&s=25 Kad Kerforn (kadoudal)
on 2007-05-02 13:50
Ivor Paul wrote:
> for one - you are looking for request.xhr instead of
> request.xml_http_request? see page 542 of the agile web development
> book.

thanks

I thought request.xhr? and request.xml_http_request? were equivalent ...
Ee0293412faca21e4ebf3326ed9d5f8c?d=identicon&s=25 Kad Kerforn (kadoudal)
on 2007-05-02 14:46
Ivor Paul wrote:
> for one - you are looking for request.xhr instead of
> request.xml_http_request? see page 542 of the agile web development
> book.

Well I see what could be the problem even if I don"t know yet teh
solution :

I am using a form_remote_tag, but I am not using a submit button....
instead, as I have a rollover button I use a link w onclick :submit()

<div id="btn_search">
<span id="search"><a href="#"
onclick="document.prop_search_form.submit();">search</a></span>
</div>


could it be the problem ?
This topic is locked and can not be replied to.