getValue() in a Controller problem, help please


#1

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.

How can I do that?

tks,

David S.


#2

David S. wrote:

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.


Rails Wheels - Find Plugins, List & Sell Plugins -
http://railswheels.com


#3

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)

<% @client_list.each do |client| -%> <%= client.name%> ....... .. .. .. .. <% end -%> <%=will_paginate(@client_list, :params => {:controller => "client", :action => "search_result", :foo => "$F('name')"})%>
Nome <%= text_field_tag :name%> .... .... ... <%= observe_form :search_form, :frequency => 0.5, :url => { :action => "search_result" } %>

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 S.


#4

Hello Mark J.,
thank you very much, it worked, and was easy… lol.
I’m getting used to rails…

tks,

David S.


#5

David S. wrote:

<%=will_paginate(@client_list, :params => {:controller => “client”,
=> “search_result” } %>

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]


Rails Wheels - Find Plugins, List & Sell Plugins -
http://railswheels.com