2 Replies Latest reply on Jan 4, 2014 10:08 AM by try67

    Javascript to auto tab

    kseaver

      I found the following on a different question related to having a Javascript auto tab when the character count maximum was reached:

       

      // Document-level function

      function tab_next(next_field_name) {

       

          // Move to next field if Enter key is pressed
          // or the user has clicked outside of the field
          // or if the number of character is the character limit
          if (event.willCommit || AFMergeChange(event).length === event.target.charLimit) {
              getField(next_field_name).setFocus();
          }
      }

       

       

      Then call it like this as the Keystroke script of a text field:

       

      // Autotab to the "text2" field

      tab_next("text2");

       

      This works really well and does exactly what I want it to. I am wondering if this can be done in reverse though as well. If I am in a field and the character count is 0 and i type backspace can it auto tab back to the previous form field?

       

      Thanks in advance for any help!!