Hi, I finally, w/paid help, got my nested form working such that the add/ remove attributes button works. Now I am wondering if it is possible to only have the ''remove'' attributes button, only show up after the first row of attributes. For example ... my form starts out with its initial row of attributes, and presently the ''remove'' button is at the end of this row, I would prefer that there be no button. Now lets assume I want to add another row of attributes and so I click on the ''add attributes'' button and another row of attributes are added with the ''remove'' button at the end of this row. I would like the ''remove'' button to only show up with this second row and any subsequent rows of attributes. I was reading a blog on the ''link_to_if'', options at this site: http://groups.google.com/group/rubyonrails-talk/post?hl=en and I was wondering where I would use this option and how. My thinking is that I would like to count how many times the ''add attribute'' button is activated and then store this in a global variable that is availabe to the ''remove'' attributes button such that is only appears is the count is > 1. So maybe I could write a method that counts the number of times the ''add attribute'' button is activated in the helper where the ''add attribute'' button is defined? Any thoughts, suggestions or hopefully encouragement as to how to solve this issue? Thanks. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Thu, Dec 13, 2012 at 6:18 AM, fuzzy <hlogoma-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I finally, w/paid help, got my nested form working such that the add/ > remove attributes button works. > > > Now I am wondering if it is possible to only have the ''remove'' > attributes button, only show up after the first row of attributes. > > For example ... my form starts out with its initial row of attributes, > and presently the ''remove'' button is at the end of this row, I would > prefer that there be no button. Now lets assume I want to add another > row of attributes and so I click on the ''add attributes'' button and > another row of attributes are added with the ''remove'' button at the > end of this row. I would like the ''remove'' button to only show up with > this second row and any subsequent rows of attributes. > > I was reading a blog on the ''link_to_if'', options at this site: > > http://groups.google.com/group/rubyonrails-talk/post?hl=en > > and I was wondering where I would use this option and how. > > My thinking is that I would like to count how many times the ''add > attribute'' button is activated and then store this in a global > variable that is availabe to the ''remove'' attributes button such that > is only appears is the count is > 1. > > So maybe I could write a method that counts the number of times the > ''add attribute'' button is activated in the helper where the ''add > attribute'' button is defined? > > Any thoughts, suggestions or hopefully encouragement as to how to > solve this issue? >I think the best solution for this issue is using css. Look at http://www.w3schools.com/cssref/sel_firstchild.asp. You can also create a js solution where you always remove the delete button whenever you add/remove a row.> > Thanks. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Thanks Jim ... I will check that link out. On Dec 12, 7:01 pm, Jim Ruther Nill <jvn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Dec 13, 2012 at 6:18 AM, fuzzy <hlog...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > > I finally, w/paid help, got my nested form working such that the add/ > > remove attributes button works. > > > Now I am wondering if it is possible to only have the ''remove'' > > attributes button, only show up after the first row of attributes. > > > For example ... my form starts out with its initial row of attributes, > > and presently the ''remove'' button is at the end of this row, I would > > prefer that there be no button. Now lets assume I want to add another > > row of attributes and so I click on the ''add attributes'' button and > > another row of attributes are added with the ''remove'' button at the > > end of this row. I would like the ''remove'' button to only show up with > > this second row and any subsequent rows of attributes. > > > I was reading a blog on the ''link_to_if'', options at this site: > > > http://groups.google.com/group/rubyonrails-talk/post?hl=en > > > and I was wondering where I would use this option and how. > > > My thinking is that I would like to count how many times the ''add > > attribute'' button is activated and then store this in a global > > variable that is availabe to the ''remove'' attributes button such that > > is only appears is the count is > 1. > > > So maybe I could write a method that counts the number of times the > > ''add attribute'' button is activated in the helper where the ''add > > attribute'' button is defined? > > > Any thoughts, suggestions or hopefully encouragement as to how to > > solve this issue? > > I think the best solution for this issue is using css. Look athttp://www.w3schools.com/cssref/sel_firstchild.asp. > You can also create a js solution where you always remove the delete button > whenever you add/remove a row. > > > > > Thanks. > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visithttps://groups.google.com/groups/opt_out. > > -- > ------------------------------------------------------------- > visit my blog athttp://jimlabs.heroku.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.