# getValue() in a Controller problem, help please

**URL:** <https://www.ruby-forum.com/t/getvalue-in-a-controller-problem-help-please/158410>\
**Category:** Rails\
**Created:** [January 23, 2009, 1:00am UTC](https://www.ruby-forum.com/t/getvalue-in-a-controller-problem-help-please/158410 "2009-01-23T01:00:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [January 23, 2009, 1:00am UTC](https://www.ruby-forum.com/t/getvalue-in-a-controller-problem-help-please/158410/1 "2009-01-23T01:00:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [January 23, 2009, 10:47am UTC](https://www.ruby-forum.com/t/getvalue-in-a-controller-problem-help-please/158410/2 "2009-01-23T10:47:32Z")

</div>

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](http://railswheels.com)

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [January 23, 2009, 9:09pm UTC](https://www.ruby-forum.com/t/getvalue-in-a-controller-problem-help-please/158410/3 "2009-01-23T21:09:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [January 25, 2009, 7:12pm UTC](https://www.ruby-forum.com/t/getvalue-in-a-controller-problem-help-please/158410/4 "2009-01-25T19:12:51Z")

</div>

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

tks,

David S.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [January 25, 2009, 4:54am UTC](https://www.ruby-forum.com/t/getvalue-in-a-controller-problem-help-please/158410/5 "2009-01-25T04:54:25Z")

</div>

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](http://railswheels.com)
