Move Focus to Next Field After QR Scan

When using the QR scanner, automatically move the focus to next field after a QR code is successfully scanned.

Code

Filename: gpqr-focus-next-field-after-scan.js

/**
 * Gravity Perks // GP QR Code // Move Focus to Next Field After QR Scan
 * https://gravitywiz.com/documentation/gravity-forms-qr-code/
 *
 * When using the QR scanner, automatically move the focus to next field after a QR code is successfully scanned.
 */
gform.addAction( 'gpqr_on_scan_success', function( decodedText, decodedResult, gpqr ) {
	gpqr.$input.parents( '.gfield' ).next( '.gfield:visible' ).find( 'input, select, textarea' ).focus();
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.