John Brigham · Jan 28, 2020

Can't get an onclick to fire for a datalistbox

I've got a pretty standard dataListBox on a pretty standard Zen page running a pretty standard query.  My problem is that I can't get the onfocus or onclick events to fire.

Thanks in advance.

2 0 5 125


It looks like the component's built in clickItem method does not call out to the contents of onclick. However, the component's dblClickItem method calls out to ondblclick.

I was trying to disable a button when something was clicked in the list.  I got around it by checking that something was selected when the button was clicked.  Kind of a pain, and weird, that onclick was a noshow.  Thanks for the answer.

I did.  Also onfocus.  Nothing from any of them.

Version 2018.1.2

<dataListBox  sql="select id from" onclick="alert('onclick');onchange="alert('onchange');ondblclick="alert('ondblclick');">

I tested this in the SAMPLES namespace on Cache for Windows (x86-64) 2018.1.2 (Build 309_5U) Wed Jun 12 2019 20:02:36 EDT. When clicking an item, I see the onchange alert. After double clicking the item I previously selected, I see the ondblclick alert.