Automatically Select a Value When Lookup field is watched

By: Rex AZ | Asked: 04/22/2025
ForumsCategory: Code SnippetsAutomatically Select a Value When Lookup field is watched
Rex AZRex AZ asked 4 weeks ago

The Problem
Here's a common usability issue with Formidable Forms Pro lookup fields. I am trying to

Use Field 32 (e.g., a lookup field for a name) to automatically populate Field 23 (e.g., a category). Field 23 is already watching Field 32. Note, Field 23 is not visible until a value is entered in field 32

But even though the value shows up in Field 23’s dropdown after selecting from Field 32, it still requires the user to click and manually select the value.

What I want to achieve: The Goal:
As soon as Field 32 is selected, Field 23 should automatically select the corresponding value (not just show it in the dropdown).

 

What I have done

Below is a simple script I wrote to handle this, but it is not working.

jQuery(document).ready(function($) {
$('#field_hnt7g').on('change', function() {
// Wait for Field 23 to become visible and populated
setTimeout(function() {
// Check if Field 23 is visible
if ($('#field_21m1c').is(':visible')) {
var selectedValue = $('#field_21m1c').val();
if (selectedValue) {
$('#field_21m1c').val(selectedValue).trigger('change');
}
}
}, 1000); // 1-second delay to allow conditional logic and lookup to complete
});
});

Chris WeiserChris Weiser replied 4 hours ago

Hi Rex, I arrived here after searching for a solution similar to what you described. Thankfully I was able to find one.

Rather than a "Lookup Field", what we actually need to do is add a regular field (I went with Text) and auto-fill it with a "Lookup Value." Here's how to do that:
1. Add a new Text Field after your source field
2. Open the Advanced accordion
3. On the top right of the first text box (Default Value), there are three icons. The Search icon is Lookup Value. Click that.
4. Search in the form and input that has the value you want.
5. Watch the lookup field that you want to match values from.
6. Save and test.

Now, when you select a value from the source lookup field, the text field should fill the value.

Hope this helps.

1 Answers
Victor Font Staff answered 4 weeks ago

"Common usability issue"? No one has complained about the issue you post about. I don't agree with the characterization this is a common issue. You haven't provided enough details about your setup, but on the surface, at least, it sounds like the fields aren't setup correctly.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right