In my Rails application, I have a basic form for shipping details:
<% form_for shipping_object do |f| %>
<%= f.text_field :address1, :placeholder => "Address Line 1*", :class => "forms" %><br/>
<%= f.text_field :address2, :placeholder => "Address Line 2", :class => "forms" %>
<%= f.collection_select :state_id, @states.where(country_id: f.object.country_id).order(:name), :id, :name, include_blank: '-- select state --' %>
<%= f.text_field :state_name, placeholder: 'State', class: 'forms' %>
<%= f.text_field :zipcode, :placeholder => "Zip Code*", :class => "forms" %>
<% end %>
I am looking to enhance the user experience by adding a checkbox that when clicked will populate all form fields with pre-defined values. I believe this can be achieved using .attr methods in JavaScript, but I am unsure of how to implement it. Can anyone provide guidance on this?