# Dynamic population checkbox plus removing/unset default checkbox value

**URL:** <https://community.gravityforms.com/t/dynamic-population-checkbox-plus-removing-unset-default-checkbox-value/19121>\
**Category:** Get Help\
**Tags:** dynamic-population\
**Created:** [March 22, 2025, 12:08pm UTC](https://community.gravityforms.com/t/dynamic-population-checkbox-plus-removing-unset-default-checkbox-value/19121 "2025-03-22T12:08:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![G7s3cx9FgVm3F8a4Q3cp](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@G7s3cx9FgVm3F8a4Q3cp](https://community.gravityforms.com/u/G7s3cx9FgVm3F8a4Q3cp)\
**Post date:** [March 22, 2025, 12:08pm UTC](https://community.gravityforms.com/t/dynamic-population-checkbox-plus-removing-unset-default-checkbox-value/19121/1 "2025-03-22T12:08:41Z")

</div>

I have a field with two checkboxes: Value 1 and value 2. I use the Dynamic Population feature and set the second checkbox (value) as checked by including the parameter in the URL (i.e. [domain.com/?checkboxgroup=value2](http://domain.com/?checkboxgroup=value2)).

However, in the form, the first checkbox is enabled by default and I want to disable it.

Is it possible to deactivate the first checkbox (also via ‘dynamic population’)?

Or is it better to set the first checkbox not enabled and enable both checkboxes with the dynamic population feature?

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [March 22, 2025, 7:54pm UTC](https://community.gravityforms.com/t/dynamic-population-checkbox-plus-removing-unset-default-checkbox-value/19121/2 "2025-03-22T19:54:44Z")

</div>

If you want to clear the defaults when dynamic population is used you can use the gform\_pre\_render filter in the theme functions.php file, in a custom plugin, or with a code snippets plugin e.g.

```auto
add_filter( 'gform_pre_render', function ( $form, $ajax, $field_values ) {
	if ( empty( $form['id'] ) ) {
		return $form;
	}

	foreach ( $form['fields'] as $field ) {

		if ( ! $field instanceof GF_Field_Checkbox || ! $field->allowsPrepopulate || empty( $field->inputName ) ) {
			continue;
		}

		$value = GFFormsModel::get_parameter_value( $field->inputName, $field_values, $field );
		if ( rgblank( $value ) ) {
			continue;
		}

		$field->defaultValue = '';

		foreach ( $field->choices as &$choice ) {
			$choice['isSelected'] = false;
		}
	}

	return $form;
}, 10, 3 );

```

---

<div class="post-metadata">

**Author:** ![G7s3cx9FgVm3F8a4Q3cp](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@G7s3cx9FgVm3F8a4Q3cp](https://community.gravityforms.com/u/G7s3cx9FgVm3F8a4Q3cp)\
**Post date:** [March 23, 2025, 2:52pm UTC](https://community.gravityforms.com/t/dynamic-population-checkbox-plus-removing-unset-default-checkbox-value/19121/3 "2025-03-23T14:52:53Z")

</div>

Great, but can I specify which default field/value should be reset/unset by using the field ID or something like that?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [April 22, 2025, 2:53pm UTC](https://community.gravityforms.com/t/dynamic-population-checkbox-plus-removing-unset-default-checkbox-value/19121/4 "2025-04-22T14:53:19Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
