Todd
2009-Apr-17 10:07 UTC
Need Help with Rails 2.3 Four Level Nested Form Javascript Function
Hi I''m using Alloy''s Complex Form Example found here(http://github.com/ alloy/complex-form-examples/tree/master). The example he provides is a two level hierarchy and I''m trying to expand it to four. He has javascript functions for adding nested items. Can someone show me how to expand for four nested layers? ''.add_nested_item'': function(e){ el = Event.findElement(e); template = eval(el.href.replace(/.*#/, '''')) $(el.rel).insert({ bottom: replace_ids(template) }); }, ''.add_nested_item_lvl2'': function(e){ el = Event.findElement(e); elements = el.rel.match(/(\w+)/g) parent = ''.''+elements[0] child = ''.''+elements[1] child_container = el.up(parent).down(child) parent_object_id = el.up(parent).down(''input'').name.match(/.*\[(\d+) \]/)[1] template = eval(el.href.replace(/.*#/, '''')) template = template.replace(/(attributes[_\]\[]+)\d+/g, "$1"+parent_object_id) // console.log(template) child_container.insert({ bottom: replace_ids(template) }); } Thanks anybody who can help! I''m really trying to learn here! I''ve posted this question on StackOverflow if anyone wants to answer it there. http://stackoverflow.com/questions/741576/need-help-with-rails-2-3-four-level-nested-form-javascript-function --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---