Problem with post url in form_remote_tag

Hi,

I’m hitting a bump with the form_remote_tag, and wondering if anyone
can
help… SO i’m trying to implement a tag-based search on a site and
using
routes, I can enter a url such as http://localhost/tag/query , which
calls
an action ‘search’, and returns all the posts which are tagged with the
word
‘query’…

fine…

In the search.rhtml page, I have a search form, that has several
filter/search options (in the select tags), and below that, there are
the
results which are updated in a results div. It essentially looks like
the
following:

                              --------------------------------

search.rhtml -----------------------------------
<%= form_remote_tag(:update => ‘search_results’, :url => {:action =>
:search}, :loading => ’ SearchController.disableSearchForm()’, :complete
=>
‘SearchController.enableSearchForm()’, :id => ‘search_form’)%>
<%= select(:search, :selection, [[‘Newest First’, ‘new’],[‘Most
Popular
First’,‘popular’]]) %>
<% select(:search, :time, [[‘Today’, ‘day’],[‘Last
Week’,‘week’],[‘Last
Month’, ‘month’],[‘Last Year’,‘year’]], {:selected => ‘month’}) %>
<%= select(:search, :field, [[‘Search By Title’, ‘title’],[‘Title
and
Descriptions’,‘description’],[‘Tags’, ‘tag’]]) %>

<%= text_field_tag 'query'%>
<%= submit_tag  'Search', :action => 'search', :onsubmit => '

SearchController.disableSearchForm();’ %>
<%= end_form_tag %>

<%= render :partial => 'search_results' %>
----------------------------------------- ---------------------

As you can see, I’m using the following syntax in the form_remote tag:

 form_remote_tag(:update => 'search_results', :url => {:action =>

:search},…

hoping that it will generate html that will post the form to
http://localhost/search
. Keep in mind that at this point, the url of the page this form is
on is
currently http://localhost/tag/query (from the previous tag search)
When I examine the html source however, or use Firebug to look at the
request, I see that the form is still being POSTed to
http://localhost/tag/query, and not http://localhost/search as I
expect…
the html looks like this:

                     ---------------------------- generated html

<form action="/tag/yard" method= "post" onsubmit="new Ajax.Updater('search_results', '/tag/yard', <hr> <p>So the question is, what am I doing wrong, and how can I make it post to<br> the<br> ‘search’ action, and not the current url of the page?</p> <p>Thanks,<br> -Sidney</p>

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