Hello all,
It looks like there is a difference in how the various clients handle clicking of items on the page.
The attached code contains a keypress event handler, which will click
an element on the page, depending on the key pressed. The DOWN_ARROW
clicks the label and the UP_ARROW clicks the button. When executed in Firefox or IE, both events fire correctly, while the
Notes client and Chrome can't seem to find the click method for the label. Lotus Notes
reports an error like:
dojo.query("*[id$='label1']")[0].click is not a function
Shouldn't this work across all clients?
Thanks,
Alex Rasmussen
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:inputText id="input1" value="#{viewScope.input1}">
</xp:inputText>
<xp:br></xp:br>
<xp:button id="button1" value="Button">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="input1">
<xp:this.action><![CDATA[#{javascript:viewScope.input1 = "Button1 Click!"}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:br></xp:br>
<xp:label value="Label1" id="label1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="input1">
<xp:this.action><![CDATA[#{javascript:viewScope.input1 = "Label1 Click!"}]]></xp:this.action>
</xp:eventHandler></xp:label>
<xp:br></xp:br>
<xp:eventHandler event="onClientLoad" submit="false">
<xp:this.script><![CDATA[dojo.connect( document, 'keypress', function(e){
if(e.keyCode == dojo.keys.DOWN_ARROW)
{
dojo.query("*[id$='label1']")[0].click();
e.preventDefault();
};
if(e.keyCode == dojo.keys.UP_ARROW)
{
dojo.query("*[id$='button1']")[0].click();
e.preventDefault();
};
}) ;]]></xp:this.script>
</xp:eventHandler></xp:view>