Problems with User Interactions on Published Site

Hello people, I just discovered that my project is having problems with user interactions through code.

In Preview, everything works perfectly, as expected and as directed by code, but the Published version does not. Some buttons, radio buttons, dropdowns and etc, do not work with the .onClick() event handler, instead, I need to go in the event handler and create through the panel the function that is going to call the code.

This is not working:

$w("#dropdownProducts").onChange(() => {
    $w("#buttonClearProducts").show()
})

So I had to change all user interactive elements that didn’t work, to something like this:

export function dropdownProducts_change(event) { 
    $w("#buttonClearProducts").show()
}

After the change everything works as expected, but it is quite annoying.

PS: I’m using Editor X.

Have you put the first one inside $w.onReady() ?

Yep, same question here.

This do not work?

$w.onReady(()=>{
	$w("#dropdownProducts").onChange(()=>{
		$w("#buttonClearProducts").show();
	});
});

Yes, of course, otherwise it wouldn’t work even in Preview.

Everything works flawlessly in Preview Mode, but I noticed a close button not working in the Published Site, and upon investigation, I discovered that it wasn’t reading the code block upon click, again, only in the Published Site. So I tried using the event handler and it worked. So I had to check every interactive element on the Published Site to discover which ones were not working, and a bunch of them need the event handler fix.

Some work for Miss Marlowe :sweat_smile: