I'm after some direction in created nested forms operating in their own forms (if that makes sense). I've created some diagrams to help explain what I'm after.
I have the nested forms working fine, I'm just interested to find out if the below is possible.
I know I don't have any code to show, but any guidance or assistance would be greatly appreciated as I'm not sure where to start.
Model
class General < ApplicationRecord belongs_to :operation belongs_to :report end
Form
<%= form_with(model: general, local: true) do |f| %> <h1>General</h1> <%= f.text_field :first_name %> <%= f.text_field :last_name %> <%= f.collection_select :property_id, Property.all, :id, :name %> <%= f.collection_select :field_id, Field.all, :id, :name %> <h1>Operations</h1> <%= f.fields_for :operations do |o| %> <%= o.text_field :model %> <%= o.text_field :type %> <%= o.collection_select :status_id, Status.all, :id, :name %> <% end %> <h1>Reports</h1> <%= f.fields_for :report do |r| %> <%= r.text_field :first_name %> <%= r.text_field :last_name %> <%= r.text_area :comments %> <% end %> <%= f.submit 'Submit' %> <% end %>
This is my standard form using nested forms for Operations and Reports resulting is something like this:
I'm looking to seperate out the Operations and Reports forms and place a link available in the General show route.
The user will click on the Operations link and bring up the nested form to edit.
1 Answers
Answers 1
I'm not sure if I understand you correctly, but I guess you can hide operations and reports using CSS, add two buttons and add an event listener on each of them to display operations form and reports form on click (changing the hidden nested forms CSS).
Aftershokz trekz titanium - Titanium Art, Tips and Tools
ReplyDeleteTitanium Art is a T-Shirts Made titanium forging by apple watch titanium vs aluminum T-Shirts Made by T-Shirts titanium bicycle Made by T-Shirts Made by T-Shirts Made by T-Shirts Made by T-Shirts Made 강원 랜드 바카라 by T-Shirts Made ford edge titanium by T-Shirts Made