Skip to content

double click preventers

Eric Draut edited this page Feb 15, 2017 · 4 revisions

Links

<%= link_to 'start long process', long_process_starter_path, prevent_double_click_hash %>

This link will stop responding to clicks after the first one.

<a href="long_process_starter_path" <%= prevent_double_click>> start long process </a>

This helper renders a raw data attribute string when you're not already inside an ERB tag.

Forms

<%= form_for payment do |f| %>
  <%= f.submit 'Make Payment', prevent_double_submit_hash %>
<% end %>

This submit button will stop responding to clicks after the first one.

<form action="payments" method="POST">
  <input type="submit"  <%= prevent_double_submit %> value='Make Payment'>
</form>

This helper renders a raw data attribute string when you're not already inside an ERB tag.

Clone this wiki locally