# Populate a field with a value depending on dropdown selected

**URL:** <https://community.gravityforms.com/t/populate-a-field-with-a-value-depending-on-dropdown-selected/9501>\
**Category:** Get Help\
**Tags:** gravity-wiz\
**Created:** [May 28, 2021, 3:56pm UTC](https://community.gravityforms.com/t/populate-a-field-with-a-value-depending-on-dropdown-selected/9501 "2021-05-28T15:56:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![user605ba0bc28408920](https://avatars.discourse-cdn.com/v4/letter/u/bb73d2/32.png) [@user605ba0bc28408920](https://community.gravityforms.com/u/user605ba0bc28408920)\
**Post date:** [May 28, 2021, 3:56pm UTC](https://community.gravityforms.com/t/populate-a-field-with-a-value-depending-on-dropdown-selected/9501/1 "2021-05-28T15:56:34Z")

</div>

I have created a dropdown in my Gravity Form and I have also created a seperate hidden field.

If the user selects option One from the dropdown I would like a value e.g “10001” to be placed in the hidden field and if option two is selected I would like the value “10009” to be placed in the hidden field.

Does anyone know if this is possible without buying another add-on. If so, can someone point me in the right direction?

---

<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:** [May 28, 2021, 5:21pm UTC](https://community.gravityforms.com/t/populate-a-field-with-a-value-depending-on-dropdown-selected/9501/2 "2021-05-28T17:21:28Z")

</div>

Hi Jason. Without buying another add-on, you would have to do this with some JavaScript or jQuery, to write the value to the hidden field after a selection is made.

The paid plugin route is to use Gravity Wiz Populate Anything, and their live merge tag feature:

> **[Gravity Forms Populate Anything - Gravity Wiz](https://gravitywiz.com/documentation/gravity-forms-populate-anything/)**
>
> Dynamically filter and populate field choices and values with posts, users, taxonomies, terms, Gravity Forms entries, and databases.

**Live Merge Tags.**  
Add auto-updating merge tags _anywhere_ inside your form (e.g. labels, descriptions, choices, values, HTML content).

---

<div class="post-metadata">

**Author:** ![user60d5af2acbf14453](https://avatars.discourse-cdn.com/v4/letter/u/8491ac/32.png) [@user60d5af2acbf14453](https://community.gravityforms.com/u/user60d5af2acbf14453)\
**Post date:** [June 28, 2021, 1:56am UTC](https://community.gravityforms.com/t/populate-a-field-with-a-value-depending-on-dropdown-selected/9501/3 "2021-06-28T01:56:44Z")

</div>

Give an `ID` “selectBox” to selectbox And “textField” to the text box. By using Jquery then you can populate its value.

```auto
$(document).on('change', 'select#selectBox', function(){
     $('#textField').val();
});

```

Also make small change in your loop, add quotes " " to value.

```auto
@foreach ($payments as $p)
      <option value ="{{$p->item}}">{{$p->item}}</option>
@endforeach

```

---

<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 5, 2022, 8:31am UTC](https://community.gravityforms.com/t/populate-a-field-with-a-value-depending-on-dropdown-selected/9501/4 "2022-01-05T08:31:20Z")

</div>


