# How to randomize the order of values in dropdown field?

**URL:** https://community.gravityforms.com/t/how-to-randomize-the-order-of-values-in-dropdown-field/7249
**Category:** Get Help
**Tags:** gravity-wiz, gform\_pre\_render, randomize
**Created:** [December 21, 2020, 6:57pm UTC](https://community.gravityforms.com/t/how-to-randomize-the-order-of-values-in-dropdown-field/7249 "2020-12-21T18:57:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![user5fe0ee9a14a36641](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/user5fe0ee9a14a36641/32/2368_2.png) [@user5fe0ee9a14a36641](https://community.gravityforms.com/u/user5fe0ee9a14a36641)
#### Post date: [December 21, 2020, 6:57pm UTC](https://community.gravityforms.com/t/how-to-randomize-the-order-of-values-in-dropdown-field/7249/1 "2020-12-21T18:57:26Z")

</div>

I can’t figure out how to simply randomize the order of values in a dropdown field.

The usecase is a lead submission form where we ask “how did you hear about us?” We don’t want to bias the results by showing the options in the same order each time - rather we want it to be random on each form load.

For example, if the options are:

1.“Google Search”  
2. “Heard from a friend”  
3. “Other”

…we would want them to be in random order each time the form is loaded or ideally just for each unique visitor.

---

<div class="post-metadata">

### Author: ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)
#### Post date: [December 21, 2020, 10:15pm UTC](https://community.gravityforms.com/t/how-to-randomize-the-order-of-values-in-dropdown-field/7249/2 "2020-12-21T22:15:21Z")

</div>

Hi Matt. Randomizing the order of the choices presented in a drop down field is not supported in Gravity Forms. If you would like to suggest that for inclusion in the future, I recommend adding that to our product roadmap. Click the blue ➕ in the lower left on this page to add a note for our product team:

> **[Login | Gravity Forms](https://www.gravityforms.com/gravity-forms-roadmap/)**

Thank you.

---

<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: [December 22, 2020, 11:12am UTC](https://community.gravityforms.com/t/how-to-randomize-the-order-of-values-in-dropdown-field/7249/3 "2020-12-22T11:12:49Z")

</div>

You could use the [gform\_pre\_render](https://docs.gravityforms.com/gform_pre_render/) filter in the theme functions.php file or a custom functions plugin to shuffle the array of choices on form display. This example applies to form id 681 and field id 1:

```auto
add_filter( 'gform_pre_render_681', function ( $form ) {
	$field_id = 1;
	$field = GFAPI::get_field( $form, $field_id );
	if ( $field instanceof GF_Field_Select ) {
		shuffle( $field->choices );
	}

	return $form;
} );

```

---

<div class="post-metadata">

### Author: ![claygriffiths](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/claygriffiths/32/2774_2.png) [@claygriffiths](https://community.gravityforms.com/u/claygriffiths)
#### Post date: [May 25, 2021, 7:18pm UTC](https://community.gravityforms.com/t/how-to-randomize-the-order-of-values-in-dropdown-field/7249/4 "2021-05-25T19:18:47Z")

</div>

Hey Matt, great question!

We had the same need at Gravity Wiz for an internal form and realized there wasn’t an off-the-shelf solution. So, we dreamt up and created [Gravity Forms Randomizer](https://gravitywiz.com/documentation/gravity-forms-randomizer/). 😃

---

<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: [January 4, 2022, 5:46pm UTC](https://community.gravityforms.com/t/how-to-randomize-the-order-of-values-in-dropdown-field/7249/5 "2022-01-04T17:46:18Z")

</div>


