Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails: Alert button on submit press

I have a function where a user can reset their own password by entering their registered email and clicking a button. An email then gets sent to that address.

<div class ="title">Reset your password</div>



<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
  <%= devise_error_messages! %>
<div class="signup">
  <div class = "field">Email: 
  <%= f.email_field :email, :class => "email" %></div>

</br>

  <div><%= f.submit "Send me reset password instructions", :class => "button", :confirm => "An email to reset your password has been sent" %></div>
</div>

<% end %>

I am wanting a pop up box to show up after they hit the submit button. I have a confirm pop up at the moment, but I am just wanting an alert popup, where the user only has the option to click "OK". Can this be done?

I am new to rails, so please remember this when trying to help. Thanks in advance.

like image 580
Jazz Avatar asked Dec 17 '25 07:12

Jazz


1 Answers

You could use:

 <%= f.submit "Send me reset password instructions", data: { confirm: 'Are you sure?' } %>
like image 143
Noushad Avatar answered Dec 19 '25 22:12

Noushad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!