Reputation: 9415
I have a modal form using bootstrap which enables the user to add different types of embedded media. I'm embedding the forms into different tabs based on file type. I'd like the "save" button in the modal footer to submit the correct form based on which form is currently in focus. I know how to find the current tab using jquery, but how can I write a conditional for the save button based on this value?
For example, to submit a video, I currently have:
<div class="modal-footer media_actions">
<%= video_form.actions do %>
<%= video_form.action :cancel, :label => "Close", :as => :link,
:button_html => {:class => "btn", :href => "#",
:data => {:target => "#mediaEmbedModal", :toggle => "modal"}} %>
<%= video_form.action :submit, :label => "Save", :as => :button,
:button_html => {:class => "btn btn-primary", :id => "video_submit", :disable_with => "Saving..."}, :disable_with => "Saving..." %>
<% end %>
<% end %>
<div class="videoLoadingIcon"></div>
</div>
but if I want to be able to change the action based on the form that's currently active, how should I do this?
Upvotes: 0
Views: 90
Reputation: 5249
Couple of options:
Upvotes: 1