Linking buttons on a dynamic page to the matching field from my database.

Hello! I’m having trouble getting buttons to work properly on my dynamic page. I created a dropdown menu of buttons that are each labeled “Arizona”, “California”, “Colorado”, and so on. They are linked to a specific field called “States” in my (read-only) database. My problem is not that the buttons aren’t working properly. They link to the corresponding field and the dynamic page displays the correct info in the table. The issue I am having is when I go to the live site or preview mode, the buttons labels all have the exact same label. I’ve tried numerous ways of linking each button, but nothing seems to work. Perhaps my database isn’t set up properly? Or, do I need to create some kind of “hook” or filter". I’m quite inexperienced when it comes to writing code. But, I’m very willing to learn, if it will solve this incredibly frustrating problem! ;)))

Please my screen shots below and let me know if I can provide more info…

Dynamic Page for “California”


This is what the buttons look like when I go to the “California” page. The buttons are supposed to list different states from the database.

1 Like

I guess the drop-down is connected to the database state field using the setting GUI of the dropdown. So it is showing all the values in that coloumn as options…

If this is the case , disconnect the connection and use code to remove the duplicate and then connect it to the drop-down.

Hi Nithin,
I’m sorry. I’m not sure what you mean. I’m not familiar with writing code, so please bear with me.

The drop down list is actually made up of a group of individual buttons that I inserted. It is not a wix user-input element. I connected each button to the database, individually. I do not know how to use code to remove the duplicate. Can you please explain in greater detail how I do this?

Thanks,
Johanna

@johannabgaber Ah a new opportunity for a tutorial :-).

Can you share the published page URL Johanna?

If you look at the screenshot of your day collection you’ll see that California shows up at least 5 times. So it seems that you have a drop down for every row in the collection.

Assuming this is the right column to use, you need to get all values in the States column and make the resulting list unique by deleting duplicates before assigning the list to your drop down.

By having a look at your page it will be easier to point at where your code needs tweaking!

Steve

1 Like

Hi I am having a similar issue. I want to have button pull certain data from my database when they’re clicked on. Does anyone know how to do this?