Populate Dropdown Options based on URL Parameter

By: Mark Hansen | Asked: 10/04/2023
ForumsCategory: General questionsPopulate Dropdown Options based on URL Parameter
Mark HansenMark Hansen asked 10 months ago
I feel like I'm missing something super-simple here, and have used lookup and dynamic fields for a while. I'm just drawing a blank on how to limit my dropdown values to a filtered list of sorts.
  • On Page 1, I have a simple 2-field form with a dropdown (lookup field, pulling options from an existing form) The user submits this form and is lead to a second page, based on their choice. The form action reads their choice and uses a separate lookup field to populate the url they are forwarded to. For the sake of example, assume they chose "Trucks". (I pass "trucks" to page 2, /trucks/ as an url parameter)
  • On Page 2, the page-content is based on their previous selection ie: trucks, and within it I have a second form where they can make a choice of which brand truck they want to see more information about from a dropdown field.
How do I populate and limit the options of that dropdown field to existing form data with the parent entry of trucks? (From a separate form with hundreds of entries, 20 of them listed as trucks)
Adam Fominaya replied 10 months ago

I'm not totally sure I follow, but I just want to make sure that your second lookup field is referencing the first? It needs to be watching the first lookup field

Mark HansenMark Hansen replied 10 months ago

Thanks, Adam. My goal is not to store the entries from the first form, since it's really just being used as a jump-menu, allowing the user to select which type of vehicle, then forwarding them to the correct page and passing the url parameter of the vehicle type.

My issue may lie in the fact that I use a single form populated with the data options for both form 1 and form 2, and hoping filtering could be done at the url paramter level.

IE: User selects trucks from form 1, gets sent to the /trucks/ page, with an url paramter of /?vehicletype=trucks

Next, I was hoping to filter a dropmenu, to show all records in my master data table (same data as form 1, but now filtered to trucks only) and populate the dropdown with the truck brand, ie: Ford, Chevrolet, etc.

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