Help example for the List box does not work


I have been trying to use the example here:

But it does not work.

It says:
javascript = onchange=\"alert('Wow! You changed it!');\"

But it looks like the onchange event never gets fired.

I have been trying to make the example work for 3-4 hours, and then found some old post here in the forum telling that the onchange is not supposed to work.

I have been testing with the onBlur event and that one gets fired.
But onBlur shows the old value of the List box and not the new selected one.

So please fix the documentation or fix the bug.

Thank you.


RE: Help example for the List box does not work

Hi Thomas,

this is most likely a remaining bug after the change of how the elements are portrayed from 7.5 to 8.x.

I agree that the documentation could (and should) be better, but if you inspect the element and see how it works, when changing a listbox it doesn't actually change the value, but instead changes the title. This is due to the listbox being both a dropdown and searchable element.

If I use this code:

javascript = onblur="alert('Some text')"

It will work when I press outside the listbox after having it focused.

If you require this an onchange to work, I advice you to add another element of type "HTML text with Parser and database" where in the body you can create your own jQuery and CSS snippets to fit your need.

Av: Simen Mostuen Iversen 4. dec 2019

RE: Help example for the List box does not work

Thank you for your reply

I have tried to use the onBlur like this:

javascript = onblur ="var value = document.getElementById('listen_label').title; alert(value);"

(The "Listen_label" is the Element name of the List box.)

When I select a new item in the List box, the onblur javascript above runs. But the value shown is the old value, and the list keeps on being shown. When I click outside the List box, the onblur script gets run again – this time with the correct value (unless I have selected something else in the List box – which runs the javascript again with the old value – always one click behind).

Does someone have an idea on how the get the value that is actually clicked?


Av: Thomas Kragh 4. dec 2019