Constantin Gavrilescu
2007-Feb-25 19:07 UTC
Dynamically uploading a list that''s already in a form
I have the classic case of: Posts, and Categories. When the user submits a post, he has a drop-down list of categories. I want to put a "Add category" link next to the list of categories. This is already inside a form, so a "link_to_remote" that creates a small AJAX form inside the "submit post" form will not work because that will mean to embed a form in another form. I can popup a window that at the end refreshes the parent window or go to a page where the user can add categories and redirect at the submit post, but that seems so ten years ago. Can anybody enlighten me on what''s the "best practice" way to update this categories list in a form? The web 2.0? -- 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 -~----------~----~----~----~------~----~------~--~---
Has anyone found a solid solution to this? This would be good for usability. On Feb 25, 3:07 pm, Constantin Gavrilescu <rails-mailing-l...@andreas- s.net> wrote:> I have the classic case of: Posts, and Categories. When the user submits > a post, he has a drop-down list of categories. I want to put a "Add > category" link next to the list of categories. > > This is alreadyinsideaform, so a "link_to_remote" that creates a > small AJAXforminsidethe "submit post"formwill not work because that > will mean to embed aformin anotherform. > > I can popup a window that at the end refreshes the parent window or go > to a page where the user can add categories and redirect at the submit > post, but that seems so ten years ago. > > Can anybody enlighten me on what''s the "best practice" way to update > this categories list in aform? The web 2.0? > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Constantin Gavrilescu
2007-Mar-20 19:14 UTC
Re: Dynamically uploading a list that''s already in a form
ebrad wrote:> Has anyone found a solid solution to this? This would be good for > usability. >Since I didn''t got an answer, I''ve done it the way I thought best: I made a "false popup" with a div over the form. I used the Redbox plugin for that. -- 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 -~----------~----~----~----~------~----~------~--~---
Yes, that''s the way I wanted to do it too, but Redbox was putting the hidden popup div inside the main form, which I coudn''t get to work. Do you have an example that you could post? Cheers Brad W. On Mar 20, 3:14 pm, Constantin Gavrilescu <rails-mailing-l...@andreas- s.net> wrote:> ebrad wrote: > > Has anyone found a solid solution to this? This would be good for > > usability. > > Since I didn''t got an answer, I''ve done it the way I thought best: I > made a "false popup" with a div over theform. I used the Redbox plugin > for that. > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Constantin Gavrilescu
2007-Mar-30 04:46 UTC
Re: Dynamically uploading a list that''s already in a form
ebrad wrote:> Yes, that''s the way I wanted to do it too, but Redbox was putting the > hidden popup div inside the main form, which I coudn''t get to work. > Do you have an example that you could post? > > Cheers > > Brad W. >Put a div named however you want _outside your form_. In the form, use the :update => ''div_id'' parameter. I used the redbox convention of naming the div. Copy/pasted from my code: <%= link_to_remote_redbox ''Edit Container'', :update => ''hidden_content_edit_container_popup'', :url => {:action => ''edit_container_popup'', :pin => container.pin } %> Then, you need to edit redbox_helper.rb. You need to get rid of all that shit with "id" "hidden_id", and use your variable that you given in :update. You also need to tell redbox not to generate the div for you. So you are left with just two lines of code. def link_to_remote_redbox(name, link_to_remote_options = {}, html_options = {}) link_to_remote_options = redbox_remote_options(link_to_remote_options, link_to_remote_options[:update]) return link_to_remote(name, link_to_remote_options, html_options) end Restart the server, and test. It works for me. I have the dev website on a subdomain of www.apluscompuservices.com (btw - dreamhost for rails is really slow). I''m not sure if my client like an "early launch" so if interested about the url, email me at costi-X/hw4M8QVluaBVVFIY0YhDj6SVQI9JRA@public.gmane.org -- 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 -~----------~----~----~----~------~----~------~--~---
werdnativ
2007-Mar-30 18:09 UTC
Re: Dynamically uploading a list that''s already in a form
In my app I simply have a submit_to_remote within the larger form... no need for a nested form. It submits the entire form including the other fields but I only read the category[:name] param when I receive it in my CategoriesController#create action. Inside a larger form... <%= text_field_tag ''category[name]'' %> <%= submit_to_remote ''add_category'', ''Add'', :url => categories_path %> I belive there is a :submit parameter available for submit_to_remote that should specify which field(s) to submit instead of the whole form, but I haven''t played with that. (See the API doc for link_to_remote: as I understand it, submit_to_remote uses the same options.) On Feb 25, 12:07 pm, Constantin Gavrilescu <rails-mailing-l...@andreas- s.net> wrote:> I have the classic case of: Posts, and Categories. When the user submits > a post, he has a drop-down list of categories. I want to put a "Add > category" link next to the list of categories. > > This is already inside a form, so a "link_to_remote" that creates a > small AJAX form inside the "submit post" form will not work because that > will mean to embed a form in another form.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---