agoragames / confirm-with-reveal

Replacement for window.confirm() using the Reveal modal popup plugin from ZURB Foundation.
http://agoragames.github.io/confirm-with-reveal/
MIT License
50 stars 19 forks source link

OK Button Does Nothing. #14

Open qops1981 opened 9 years ago

qops1981 commented 9 years ago

I got everything set up but when I click the OK button. Nothing happens. I don't go to a different page or anything.

I can say I only copied the two JS files from the Build folder over to my sites _js directory. I'm not sure if there were other important files that I missed.

Using FireFox 32.0.3 In Head:

<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link rel='icon' href='//favicon.ico' type='image/x-icon' sizes='16x16'>
<script src='_inc/foundation/js/vendor/jquery.js'></script>
<link rel='stylesheet' href='_inc/foundation/css/foundation.css' />
<script src='_inc/foundation/js/vendor/modernizr.js'></script>
<script src='_inc/foundation/js/foundation/foundation.js'></script>
<script src='_inc/foundation/js/foundation/foundation.reveal.js'></script>

In Body:

<form action="anotherpage.php" method="post">
<!-- Selections  -->
        <input id="commit" class="button alert" data-confirm type="submit" name="submit" value="Apply Change" />
<!-- Other Buttons -->
</form>

in Footer:

<script src="_js/confirm_with_reveal.js"></script>
<script> 
$(document).confirmWithReveal();
</script>
qops1981 commented 9 years ago

P.S. Cancel Button Works Fine.

jletourneau commented 9 years ago

Taking a look at this. The first thing that I'd note is that you don't need both confirm_with_reveal.js and confirm_with_reveal.min.js to be included, just one or the other. Those are two versions of the same file (the latter is minified ahead of time for people who can't or don't want to use Rails' asset pipeline or Grunt or Gulp or whatever to do that for them).

MandicaAtSupsi commented 8 years ago

Fixed with this in code on 49 line, before: if ($el.is('form, :input')) { return $el.closest('form').removeAttr('data-confirm').submit(); }

After: if ($el.is('form, :input')) { modal.foundation('reveal', 'close'); return $el.closest('form').removeAttr('data-confirm').submit(); }