Dynamic pages: Problems with dropdown linkable menus and multistate boxes (non related to dataset)

Hi all!

I have in my home page a dropdown menu inside a state of a multistate box that works perfect:
reference: https://www.minicabtransfermalaga.co.uk
it works due to this code:

import wixLocation from 'wix-location';
$w.onReady(function () {
 //code for switching state in multistate box
  $w("#button73").onClick(() => {
  $w("#button72").onClick(() => {
    $w("#button82").onClick(() => {
  $w("#button83").onClick(() => {
//dropdown menu code
$w("#dropdownOrigin").options = [
  {"label": "MALAGA AIRPORT (AGP)", "value": "https://www.minicabtransfermalaga.co.uk/s1-route-selection-o-agp-iv"},
  {"label": "MALAGA TRAIN (M.ZAMBRANO)", "value": "https://www.minicabtransfermalaga.co.uk/s1-route-selection-o-train-iv"},
//(...) the rest of the options with their links (...)

//to navigate to the dropdown menu value as link
export function dropdownOrigin_change(event) {
 //Add your code for this event here: 
 let url = $w('#dropdownOrigin').value;

The problem appears when I copied the multistatebox (and the code) to a dynamic page, it doesn’t work, neither the state change or the dropdown links.

For example in this one:

I have tried a lot of things without luck, and I thought that this one would work, but neither:
I tried to change the .onReady function to this:
$w(“#dynamicDataset”).onReady(function () { //(…)

I do not know why it does not work, I am sure that there is something missing in the code, I have chequed the corvid documentation but i have not found the solution.

Thanks in advance.

A dynamic dataset onReady() function is not the same as a page onReady() function. You need to use:

$w.onReady(function () {
	// you put the code here that needs to run when the page is ready

I believe the problem is that you didn’t connect the dropdownOrigin_change() function to the Dropdown element on the page. Like this:

I forgot to check that :slight_smile:
Thanks @yisrael-wix !

Solved for the dropdown, now it works perfectly, but the multi state box sometimes fails on changing states, I’ve cheked the connection and onclick handlers but it does not work fine always.

Thanks in advance,

When a dynamic page is accessed for the first time, buttons on the multistate box works perfect, but when I advance to the next item of the data set (a new dynamic page) it fails until I refresh the page in the browser, it is strange.

The red surrounded button changes the dynamic page, when I go to the next, the multistate box on the right does not work.
(e.g.: When click on Same Day Transfer)

Everything seems to work fine. I click the arrow and it goes to the next dynamic page. I click on Same Day Transfer and it changes. What am I missing?

Thanks for your help again Yisrael, it is strange, sometimes after clicking the arrow in the next dynamic page, “the same day transfer” button does not work.

Now seems to be fine xD.

1 Like