getValue() in a Controller problem, help please.

David Sousa wrote:

Hello there,

I'm trying to do something like:

render :update do |page|
    page[:client_list].replace_html render(:partial => 'client_list',
:object => @clients_list)
    name = page[:name].getValue();
end

but I'm not getting the value, or somehow use $("name").getValue()
inside of the controller.

You will need to send this value as a parameter of your AJAX
call, using the :with parameter of the form helper.

Hello Mark, thanks... but, my problem is bigger than that or I don't
know how that the answer is easy.

So, I have a structure like this. (view)

<div id="my_client_list">
    <% @client_list.each do |client| -%>
        <%= client.name%>
        ....... .. .. .. ..
    <% end -%>
<%=will_paginate(@client_list, :params => {:controller => "client",
:action => "search_result", :foo => "$F('name')"})%>
</div>

<div id="search_form_div">
    <form class="sidebar-search-companies" id= 'search_form'>
  <label for="nome">Nome</label>
  <%= text_field_tag :name%>
  .... .... ...
    </form>
    <%= observe_form :search_form, :frequency => 0.5, :url => { :action
=> "search_result" } %>
</div>

What I wanna do is, pass the :name.value of the search form to the
paginate action, so when the result is paginated I will still have the
same results. Otherwise, when I go the the second page for example, I
will have the second page of all my clients, not the result of the
search.

Sounds confusing... did you understand?

Tks,

David Sousa

David Sousa wrote:

Hello Mark, thanks... but, my problem is bigger than that or I don't know how that the answer is easy.

So, I have a structure like this. (view)

<div id="my_client_list">
    <% @client_list.each do |client| -%>
        <%= client.name%>
        ....... .. .. .. ..
    <% end -%>
<%=will_paginate(@client_list, :params => {:controller => "client", :action => "search_result", :foo => "$F('name')"})%>
</div>

<div id="search_form_div">
    <form class="sidebar-search-companies" id= 'search_form'>
  <label for="nome">Nome</label>
  <%= text_field_tag :name%>
  .... .... ...
    </form>
    <%= observe_form :search_form, :frequency => 0.5, :url => { :action => "search_result" } %>
</div>

What I wanna do is, pass the :name.value of the search form to the paginate action, so when the result is paginated I will still have the same results. Otherwise, when I go the the second page for example, I will have the second page of all my clients, not the result of the search.

Since you're using observe_form, params[:name] will be set
in your controller action, which can be used in the view.
e.g. :foo => params[:name]