Hi all... Can we render a partial file while clicking on a link? I tried the following: <%= link_to_remote( "Cancel", :update => "edit_func_spec_div", :url => {:partial => ''cipart/show_functional_spec_to_edit''} ) %> But it didn''t rendered the partial file specified. Also i need to pass a variable to this partial file. How can i do this? Please help Thanks in advance Regards Suneeta -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 17 Mar 2008, at 11:15, Suneeta Km wrote:> > Hi all... > Can we render a partial file while clicking on a link? > > I tried the following: > > <%= link_to_remote( "Cancel", > :update => "edit_func_spec_div", > :url => {:partial => > ''cipart/show_functional_spec_to_edit''} > ) %> >You can do this, but not like that. The action you specify by the :url hash can render any partial you fancy. Fred> > But it didn''t rendered the partial file specified. > > Also i need to pass a variable to this partial file. How can i do > this? > > Please help > > Thanks in advance > Regards > Suneeta > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 17 Mar 2008, at 11:15, Suneeta Km wrote: > >> ) %> >> > You can do this, but not like that. The action you specify by the :url > hash can render any partial you fancy. > > FredHi Fred.... Thanks for your reply I changed my code like this: <%= link_to_remote( "Cancel", :update => "edit_func_spec_div", :url => ''cipart/show_functional_spec_to_edit'' ) %> But ''no action found'' message generated. cipart is not an action. It is a folder that contains all partial files in my project. So I changed the code as follows: <%= link_to_remote( "Cancel", :update => "edit_func_spec_div", :url => ''/cipart/show_functional_spec_to_edit'' ) %> Then routing error generated. Please help to solve this. Thanks Suneeta -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Suneeta Km wrote:> Hi all... > Can we render a partial file while clicking on a link? > I tried the following: > <%= link_to_remote( "Cancel", > :update => "edit_func_spec_div", > :url => {:partial => > ''cipart/show_functional_spec_to_edit''} > ) %><%= link_to_remote( "Cancel", :update => "edit_func_spec_div", :url => {:controller => ''mycontroller'', :action => ''myaction'', :myvar => 100 }) %> and then, in Class MyController < ... ... def myaction myvar = params[:myvar] render :partial => ''your/partial'', :locals => {:myvar => myvar } end end hth -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shai Rosenfeld wrote:> Suneeta Km wrote: >> Hi all... >> Can we render a partial file while clicking on a link? >> I tried the following: >> <%= link_to_remote( "Cancel", >> :update => "edit_func_spec_div", >> :url => {:partial => >> ''cipart/show_functional_spec_to_edit''} >> ) %> > > <%= link_to_remote( "Cancel", > :update => "edit_func_spec_div", > :url => {:controller => ''mycontroller'', :action => > ''myaction'', :myvar => 100 }) %> > > and then, in > > Class MyController < ... > ... > > def myaction > myvar = params[:myvar] > render :partial => ''your/partial'', :locals => {:myvar => myvar } > end > > end > > hthHi... Can''t we directly render a partial file in link_to_remote? Thanks Suneeta -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 17 Mar 2008, at 11:43, Suneeta Km wrote:> > > > Hi... > > Can''t we directly render a partial file in link_to_remote?No you can''t. link_to_remote generates javascript to make a request to your server. if you want that to render a partial then you need to have an action on the other side that renders that partial. Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 17 Mar 2008, at 11:43, Suneeta Km wrote: > >> >> >> >> Hi... >> >> Can''t we directly render a partial file in link_to_remote? > > No you can''t. link_to_remote generates javascript to make a request to > your server. if you want that to render a partial then you need to > have an action on the other side that renders that partial. > > FredThanks Fred. I have to implement this function in many places. I was trying to avoid writing many actions for such a simple functionality. So now i''m planning to write a single action and combine all by checking conditions. Thanks again Suneeta -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi... Is there any options other than link_to_remote for solving my problem? Suneeta -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
if you didn''t want to use ajax, you could use javascript directly? You could render the form on the page, hide it, then show it when you click on your link. e.g: <div id="my-hidden-form" style="display:none"> <%= render :partial => "/cipart/show_functional_spec_to_edit" %> </div> <%= link_to_function "Cancel", "$(''my-hidden-form'').show()" %> However that depends on how complex your hidden section will be... it might not be appropriate. On Mar 18, 1:16 am, Suneeta Km <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi... > Is there any options other than link_to_remote for solving my problem? > Suneeta > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---