You are viewing limited content. For full access, please sign in.

Question

Question

Script not working after upgrade to Forms 9.1

asked on April 30, 2014

I built a form initially with Forms 9.0 and had a Javascipt than switched the Enter key on your keyboard  to perform like the TAB key, after the upgrade to 9.1 it wouldn't work. I tried to restore the form with no luck.

below is the code i used initially

 $('body').on('keydown', 'input, select, textarea', function(e) {
    var self = $(this)
      , form = self.parents('form:eq(0)')
      , focusable
      , next
      ;
    if (e.keyCode == 13) {
        focusable = form.find('input,a,select,button,textarea').filter(':visible');
        next = focusable.eq(focusable.index(this)+1);
        if (next.length) {
            next.focus();
        } else {
            form.submit();
        }
        return false;
    }
});  

Any thoughts?

0 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on May 1, 2014

Cool idea! Just put this code inside your document.ready function and you should be all set.

$(document).ready(function () {
  $('body').on('keydown', 'input, select, textarea', function(e) {
    var self = $(this)
      , form = self.parents('form:eq(0)')
      , focusable
      , next
      ;
    if (e.keyCode == 13) {
        focusable = form.find('input,a,select,button,textarea').filter(':visible');
        next = focusable.eq(focusable.index(this)+1);
        if (next.length) {
            next.focus();
        } else {
            form.submit();
        }
        return false;
    }
});  
});

 

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.