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
<tr><td><%= link_to_remote(''Close'',
                :update => ''position'',
                 :url => { :action => :close, :id => position, 
:closing_date => Date.new } ) %></td></tr>
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
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 Jackson:> 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 > > <tr><td><%= link_to_remote(''Close'', > :update => ''position'', > :url => { :action => :close, :id => > position, :closing_date => Date.new } ) %></td></tr> > > 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 > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Thomas Fuchs 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
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 }) %></td></tr>
          </table>
          <!--[eoform: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
On Nov 9, 2005, at 12:39 AM, Kev Jackson wrote:
> 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
>
> <tr><td><%= link_to_remote(''Close'',
>                :update => ''position'',
>                 :url => { :action => :close, :id =>  
> position, :closing_date => Date.new } ) %></td></tr>
>
> 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
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>