Jason Tuttle
2006-Apr-07 17:40 UTC
[Rails] Re: Re: page.replace_html "#{var_containing_id_name}", :partial
> you mean like this? > > def do_some_ajax_thing > <at> element_id = "content_div" > end > > do_some_ajax_thing.rjs > > page.replace_html <at> element_id, :partial => "edit" > > remember, the view templates have access to the attributes defined > in the controllerActually, its more like this: I have a list page. Each row is a div whose id is the id of the record it represents. When you click on the ''edit'' link in a row, I want to page.replace_html the div for that record. The only way I know the id of the div is from params[:id] Unfortunately, page.replace_html params[:id], :partial => "edit" doesn''t work. : ) Jason
Chris Hall
2006-Apr-07 17:51 UTC
[Rails] Re: Re: page.replace_html "#{var_containing_id_name}", :partial
def show_edit_form @user = User.find(params[:id]) end show_edit_form.rjs page.replace @user.id, :partial => "edit_form" end _edit_form.rhtml <%= start_form_tag :action => :update %> <%= text_field :user, :name %> ... <%= end_form_tag %> On 4/7/06, Jason Tuttle <jason@gothamcitymacs.com> wrote:> > > you mean like this? > > > > def do_some_ajax_thing > > <at> element_id = "content_div" > > end > > > > do_some_ajax_thing.rjs > > > > page.replace_html <at> element_id, :partial => "edit" > > > > remember, the view templates have access to the attributes defined > > in the controller > > Actually, its more like this: I have a list page. Each row is a div > whose id is the id of the record it represents. When you click on the > ''edit'' link in a row, I want to page.replace_html the div for that > record. The only way I know the id of the div is from params[:id] > > Unfortunately, > > page.replace_html params[:id], :partial => "edit" > > doesn''t work. > > : ) > > Jason > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060407/d152b86f/attachment.html
Chris Hall
2006-Apr-07 17:52 UTC
[Rails] Re: Re: page.replace_html "#{var_containing_id_name}", :partial
typo, sorry... show_edit_form.rjs ---------- page.replace @user.id, :partial => "edit_form" On 4/7/06, Chris Hall <christopher.k.hall@gmail.com> wrote:> > def show_edit_form > @user = User.find(params[:id]) > end > > show_edit_form.rjs > page.replace @user.id, :partial => "edit_form" > end > > _edit_form.rhtml > > <%= start_form_tag :action => :update %> > <%= text_field :user, :name %> > ... > <%= end_form_tag %> > > > On 4/7/06, Jason Tuttle < jason@gothamcitymacs.com> wrote: > > > > you mean like this? > > > > > > def do_some_ajax_thing > > > <at> element_id = "content_div" > > > end > > > > > > do_some_ajax_thing.rjs > > > > > > page.replace_html <at> element_id, :partial => "edit" > > > > > > remember, the view templates have access to the attributes defined > > > in the controller > > > > Actually, its more like this: I have a list page. Each row is a div > > whose id is the id of the record it represents. When you click on the > > ''edit'' link in a row, I want to page.replace_html the div for that > > record. The only way I know the id of the div is from params[:id] > > > > Unfortunately, > > > > page.replace_html params[:id], :partial => "edit" > > > > doesn''t work. > > > > : ) > > > > Jason > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060407/3752834a/attachment.html
Apparently Analagous Threads
- Re: page.replace_html "#{var_containing_id_name}", :partial
- Re: page.replace_html "#{var_containing_id_name}",:partial
- page.replace_html "#{var_containing_id_name}", :partial => ''edit''
- Ajax.Request onComplete
- Trying to delete from a unordered list using ajax