How Do i add an "Are You Sure?" button in my update controller
Hi
I want add a pop up button that says "Are you sure" when the user clicks on submit ? if it was a destroy mehod it would be something like this method: :delete, data: { confirm: "Are you sure?"} but not sure how to do it on the update method
def update
if donation_plan.update(donation_plan_params)
redirect_to :back, notice: "Thank you for your Gift Aid Donation"
else
render :show
end
end
or do i add this to the show page
= simple_form_for donation_plan, url: my_donations_path do |f|
= f.input :giftaid, inline_label: " reclaim Gift Aid of 25p, in every £1 on past donations and all future donations I may make.", label: false
%p= f.submit "Submit", class: "btn btn-primary"
I think its this
%p= f.submit "Submit", class: "btn btn-primary", data: { confirm: "Are you Sure"}
Yeah, data-confirm is just a generic attribute you can use on any clickable item, not just delete links. That should work fine.