# Help needed with link\_to\_remote

**URL:** <https://www.ruby-forum.com/t/help-needed-with-link-to-remote/47563>\
**Category:** Rails\
**Created:** [November 12, 2005, 12:49pm UTC](https://www.ruby-forum.com/t/help-needed-with-link-to-remote/47563 "2005-11-12T12:49:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevin.jackson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/85f322/32.png) [@kevin.jackson](https://www.ruby-forum.com/u/kevin.jackson)\
**Post date:** [November 12, 2005, 12:49pm UTC](https://www.ruby-forum.com/t/help-needed-with-link-to-remote/47563/1 "2005-11-12T12:49:28Z")

</div>

I have a table that I automatically generate on the fly from all the  
Positions in teh database, I want the user to be able to click on a  
close link next to a position and for the list to be automatically  
updated.

I currently have

\<%= link\_to\_remote('Close', :update =\> 'position', :url =\> { :action =\> :close, :id =\> position, :closing\_date =\> Date.new } ) %\>

and in my positions\_controller  
def close  
#@position = Position.find(params[:id])  
#@position.closing\_date = params[:closing\_date]  
#if @position.save  
render(:layout =\> false)  
#end  
end

So all I’m trying to do is update the view right now

And it doesn’t work.

As there are no form elements (buttons, input etc), I’m fairly sure that  
I shouldn’t be using the form\_remote tag, but how do I get this to work?

Looking through the Agile book I can’t see what I’m doing wrong,

Kev

---

<div class="post-metadata">

**Author:** ![kevin.jackson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/85f322/32.png) [@kevin.jackson](https://www.ruby-forum.com/u/kevin.jackson)\
**Post date:** [November 12, 2005, 12:49pm UTC](https://www.ruby-forum.com/t/help-needed-with-link-to-remote/47563/2 "2005-11-12T12:49:29Z")

</div>

What’s the element referenced by id=“position” ?  
If you’re on IE and the element is part of a HTML table, you might be  
in trouble.

What Rails version are you on? And what Prototype version (see  
beginning of public/javascripts/protoype.js)?

Btw, Rails 0.14.x should work fine with IE table elements.

Cheers,  
Thomas

Am 09.11.2005 um 08:39 schrieb Kev J.:

---

<div class="post-metadata">

**Author:** ![kevin.jackson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/85f322/32.png) [@kevin.jackson](https://www.ruby-forum.com/u/kevin.jackson)\
**Post date:** [November 12, 2005, 12:49pm UTC](https://www.ruby-forum.com/t/help-needed-with-link-to-remote/47563/3 "2005-11-12T12:49:29Z")

</div>

Thomas F. wrote:

> What’s the element referenced by id=“position” ?

it’s a div inside a table…

> If you’re on IE and the element is part of a HTML table, you might be  
> in trouble.

I’m testing on firefox 1.5 so no IE problems as yet

> What Rails version are you on? And what Prototype version (see  
> beginning of public/javascripts/protoype.js)?

0.14.3

Right now I’m about halfway there 🙂 I can get a visual\_effect to  
highlight, but it effects the wrong partial (annoyingly).

Basically I want to affect the style of the text (strike-through) when  
clicking a link\_to\_remote, but during debugging I’ve just switched to  
using highlight so that I can see if anything is working.

I’ve posted more code and explanation under a different topic (ajax  
problem)

Thanks for the reply

Kev

---

<div class="post-metadata">

**Author:** ![kevin.jackson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/85f322/32.png) [@kevin.jackson](https://www.ruby-forum.com/u/kevin.jackson)\
**Post date:** [November 12, 2005, 12:49pm UTC](https://www.ruby-forum.com/t/help-needed-with-link-to-remote/47563/4 "2005-11-12T12:49:31Z")

</div>

I’m getting a strange behavior as well:

\<%= form\_remote\_tag(:update =\> “results”, :url =\> { :controller =\>  
‘admin’, :action =\> :search } ) %\>

```
      <!--[form:search]-->
      <table>
      <tr><td><label>search:</label></td>
          <td><%= text_field_tag :phrase %>
              <%= observe_field(:phrase,
              :frequency => 0.5,
              :update => :results,
              :url => { :controller => 'admin', :action

```

=\> :search }) %\>

\<%= end\_form\_tag %\>

But I’m getting an error stating that the object is nil when it  
contains ‘jim’. Take a look at the parameters passed. Quite odd?  
Shouldn’t it be {“phrase”=\>“jim”}

TypeError in Admin#search

cannot convert nil into String  
RAILS\_ROOT: ./script/…/config/…

Application Trace | Framework Trace | Full Trace  
#{RAILS\_ROOT}/app/models/member.rb:54:in `+' #{RAILS_ROOT}/app/models/member.rb:54:in`search\_for’  
#{RAILS\_ROOT}/app/controllers/admin\_controller.rb:16:in `search’  
Request

Parameters: {“jim”=\>"", “\_”=\>""}

- Jim
