title: Ruby on rails confirm on submit tag with condition
body: <p>On my edit page I will need to make a confirm box pop up if you try to set the end date before the start date.</p>
  
  <p>I have a submit button, but need to get a confirm box coming up when the button is pressed but only if you have moved the end date before the start date. If you have not moved the end date before the start date it will not pop up.</p>
  
  <p>I have so far used </p>
  
  <pre><code>&lt;%=submit_tag "#{@record.id ? _('Save') : _('Create')}", :class=&gt;"btn primary med", data: {:confirm =&gt; "Are you sure?"} %&gt;
  </code></pre>
  
  <p>but that doesn't do anything at all.</p>