Erwin
2012-Oct-09 14:42 UTC
Form Design issue - How to handle a parent association input..
I have an Event Model with a parent Place association class Event < ActiveRecord::Base belongs_to :place accepts_nested_attributes_for :place attr_accessible :place_attributes In a new event registration form, the user should have the choice to : - select from an existing Place - enter a new Place in a nested form = simple_form_for @event = f.association :place, :collection => Place.all(:order => ''label''), :prompt => "Choose an Place", :label => false .. = f.simple_fields_for :place do |pf| #geolocation.form-inputs = pf.simple_fields_for :geolocation do |g| = render "backoffice/places/ geolocation_fields", :f => g should I manage that with a jQuery script ? - when user select a place , it will clear the nested place form - when user enter data in the nested place form, it will reinitiate the place select how can I manage the duplicated attribute param ? ( should the js script add/remove the corresponding html elements ?) I''m a little bit lost in translation..... -- 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.
Reasonably Related Threads
- Simple_Form and Simple_Fields_For and working in Form_Tag, Fields_For
- 3 models in a form.
- do you think it's the best solution?
- [Rails 3.2] form_tag w :remote => true doesn't fire up the js format
- how to get the index of the element passed to the render view ?