Hi,

I have problem in rich:hotkey when using JQuery

i have used rich:hotKey for h:inputText in my jsp page.

And also i wrote jQuery for get the textBox value.

When i use jquery, that time rich:kotKey not worked

<%@page contentType="text/html" pageEncoding="UTF-8"%>  
 <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>  
 <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>  
 <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>  
 <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>  
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
 "http://www.w3.org/TR/html4/loose.dtd">  
   
 <html>  
 <f:view>  
     <head>  
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
          <title>JSP Page</title>  
          <script type="text/javascript" src="../../resource/js/jquery.min.js"/>  
          <script type="text/javascript">   
              function typedName()  
              {  
                   //Get The value using styleClass id  
                   var userName = jQuery.trim($('.textBox').val());  
                   alert("Name is : " + userName);  
              }  
   
              // If i am not use above typedName() script and load src, then  
              // the following testButton() clicked script perfectly worked.  
   
              function testButton()  
              {  
                   alert("Test Button Clicked");  
              }  
           </script>  
 </head>  
 <body>  
   
 <h:form>  
     <rich:panel>  
   
           <h:outputText value="Enter your Name : "/>  
           <h:inputText id="textBox" styleClass="textBox" value ="" />   
   
           <a4j:commandButton id="nameButton" value="NameButton"    
                              onclick="typedName();"/><br>  
   
           <a4j:commandButton id="testButton" value="TestButton" 
                              onclick="testButton();" />  
             
           <rich:hotKey key="return"   selector="#textBox"   
                        handler="# 
                    {rich:element('testButton')}.click();                        event.stopPropagation();                                                                                                        event.preventDefault(); return false;"/>  
        </rich:panel>  
      </h:form>  
    </body>     
 </f:view>  
 </html>

if i am not include the jquery, then that time i hit the enter button from text box, then automatically called testButton() script.

If i include the Jquery, then rich:hotkey not work.

I am also Used , var $J = jQuery.noConflict(); . But this time also not work jQuery.

I take lot of effort this.

I hope help me about this.

Thanks for your effort.

Sorry for my inconvenience question title.

my original question is :

Is Jquery support to rich:hotKey component in JSF?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.