Created
December 29, 2020 11:43
-
-
Save ahmad19/fc5b1fcc8f275b336c701287c7fb4a50 to your computer and use it in GitHub Desktop.
Rails example of an ajax form with a select_tag of grouped options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_tag(submit_path, remote: true, method: :get, id: 'add_line_item') do %> | |
<div class="col"> | |
<div class="form-row"> | |
<div class="col-md-10"> | |
<%= grouped_collection_select(:line_item, :product_id, current_user.categories, :products, :name, :id, :name, { prompt: '--Select Product--' }, { class: 'form-control form-control-sm' }) %> | |
</div> | |
<div class="col text-center"> | |
<%= submit_tag 'Add', class: 'btn btn-outline-secondary btn-sm'%> | |
</div> | |
</div> | |
</div> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment