Drop Down Lockouts

Only allow a selection in a single Drop Down field, disabling other Drop Down fields in that group.

Instructions

Code

Filename: gw-drop-down-lockouts.js

/**
 * Gravity Wiz // Gravity Forms // Drop Down Lockouts
 * https://gravitywiz.com/
 *
 * Instruction Video: https://www.loom.com/share/e07ca5170660413a9804f146b2b569c0
 *
 * Only allow a selection in a single Drop Down field, disabling other Drop Down fields in that group.
 */
var $selects = $( '#input_GFFORMID_1, #input_GFFORMID_2, #input_GFFORMID_3' );
$selects.change( function() {
	if ( $( this ).val() ) {
		$selects.not( $( this ) ).val( '' ).prop( 'disabled', true );
		$( this ).prop( 'disabled', false );
	} else {
		$selects.prop( 'disabled', false );
	}
} );

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.