Populate a field with a value depending on dropdown selected

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?

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:

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

1 Like

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

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

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

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