None of the Above Checkbox [RESOLVED]

Is there a way to achieve this below:

  1. When “none of the above” is checked: all the other options become unchecked and disabled.
  2. When “none of the above” is unchecked: all the other options become enabled again.

checkbox

See example below:
https://austinpray.com/javascript/2015/02/14/jquery-none-of-the-above-checkboxes.html

Thank you in advance.

1 Like

I wanted to try an adaptation of this on a GF form, but I’m being hamstrung by time. Maybe you can make it work?

1 Like

Hi Phil. The customer was provided this snipped in support, which worked:

Here is a snippet you can add which will allow you to use a checkbox option that has value of none in order to deselect other options on the field.

$('.gfield-choice-input[value="none"]').on('change', function() {
  if ( $(this).is(':checked') ) {
	$(this).parent().siblings().find('.gfield-choice-input').each( function() {
		this.checked = false;
	});
  }
});

$('.gfield-choice-input:not([value="none"])').on('change', function() {
  if ( $(this).is(':checked') ) {
	$(this).parent().siblings().find('.gfield-choice-input[value="none"]').prop('checked',false);
  }
});
2 Likes

Awesome! Thanks for sharing that, Joshua!

3 Likes
© 2008 - 2021. Gravity Forms is a project by Rocketgenius Inc.