This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 6, 2012, 10:45 AM
10 Posts

Unable to click label using CSJS

  • Category: Dojo and Client Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 2
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>

 
 
 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal