js timerでformを制御して何度も提出します.

682 ワード


Form.Element.AfterActivity = function(element, callback, delay) {
  element = $(element);
  if (!delay) delay = 0.25;
  new Form.Element.Observer(element, delay, function(element, value) {
    if (element.activity_timer) clearTimeout(element.activity_timer);
    element.activity_timer = setTimeout(function() { callback(element); }, delay * 1000 + 50);
  });
};

<script type="text/javascript">
//<![CDATA[
 Form.Element.AfterActivity('btn_submit', function(element) { $(element).up('form').submit(); }, 0.35);
//]]>
</script>