I’ve also tried setting the selected index on the actual select elements themselves but the events all require some kind of interaction - click, hover etc.
I’ve also tried adding a bit of jquery but this has no effect either, e.g…
So are they dependant or not? If they are, then you need to select the value of the first one only, right?
Also - do they have a static 'select an option' option added to them?
I was thinking once the options have loaded in the first dropdown (and the first value was auto selected) the options in the next dependent dropdown would load and so on. I figured there must be a way to auto select the first option in a dropdown once it’s been populated (like the ‘selected’ property of a static dropdown).
Maybe I’m wrong though.
But I still can’t get the first dropdown to work which would at least be something.
Well it’s better if they are separate.
So it should be working perfectly fine. When the first select loads then its first option will be selected, and then it will filter the other server action.
What is the issue then? What exactly is not working as you expect it to?
Are you sure you are filtering the database queries in the server actions correctly?
The dependencies are all working fine, it’s just not selecting the first value when I load the page, even though I have specified the selectedIndex on page load.
In the following screenshot the ‘DKI Jakarta’ value should be selected…