Forums

CF7 Dynamic Dropdown to populate fields

cmwincom 22 Jan, 2024
I have a dynamic dropdown that when a value is selected I would like it to populate/fill two additional fields on my form.
The dynamic dropdown is reading from a table with the following columns: id, tname, tid, and tcode. It gets it's value and text from the tname column.
Each tname entry has a unique tid and tcode.

What I need to do, is when a value in the dynamic dropdown is selected it autofills the tid and tcode fields on the form with the values from the table. The form data gets saved to another table.

The table for the dropdown looks like this:

id tname tid tcode
1 Winter Cup 33 WC
2 Cap Dist Open 34 CDO
3 North East Open 45 NEO

There are no duplicates and won't be, but tname, tid, and tcode are saved to another table where it will be duplicated many times.

This table looks like this.

id tname tid tcode tyear tdate
1 Winter Cup 33 WC 2023 2023-01-29
2 Cap Dist Open 34 CDO 2023 2023-05-13
3 North East Open 45 NEO 2023 2023-08-12
4 Winter Cup 33 WC 2024 2024-01-28
5 Cap Dist Open 34 CDO 2024 2024-04-28
6 North East Open 45 NEO 2024 2024-08-10

My goal is simple. Select a value in the dropdown for tname and autofill tid and tcode. Looking for direction/guidance to do this simply and effectively.

Thanks in advance.
You need to login to be able to post a reply.