4 Replies Latest reply on Mar 13, 2009 7:18 AM by Ilya Shaikovsky

    rich:hotKey giving java script error

    ramki dirisala Novice

      hi,
      in my app i have main page where i can launch the pop up for some purpose,in side popup i have one text box and one button and cofigured hotkey for that button. when ever i enter somthing inside text box,immediatly i am getting following java script error.


      that.all[..].events[...].callbackMap is null or not an object.

      thanks,
      ramki.[/url]

        • 1. Re: rich:hotKey giving java script error
          Ilya Shaikovsky Master

          please add your page snippet.

          • 2. Re: rich:hotKey giving java script error
            ramki dirisala Novice

            <f:subview id="LookupCustomerForPricingPage">
            <h:form id="LookupCustomerForPricing">
            <h:inputHidden id="errorCheckCustomerFlag"
            value="#{customerHierarchy.errorCheckCustomerFlag}" />
            <a4j:keepAlive beanName="customerHierarchy" ajaxOnly="false" />
            <rich:spacer width="10" height="10" />
            <h:panelGrid id="lookUpCustomerPanel">
            <h:outputLabel id="errorId"
            value="#{messages.error_labelLookupCustomerForPricing_noCustomer}"
            style="color:red;float:left"
            rendered="#{customerHierarchy.errorCheckCustomerFlag}" />
            <rm:message forId="errorId"
            style="color:red;float:left;padding-left:5px;font:bold 9pt" />

            <a4j:outputPanel ajaxRendered="true">
            <h:outputLabel id="errorMessage"
            value="#{messages.labelAllPages_ErrorMessage}"
            style="color:red;float:left"
            rendered="#{! empty facesContext.maximumSeverity &amp;&amp; ! customerHierarchy.noCustomer}" />
            </a4j:outputPanel>
            <a4j:outputPanel ajaxRendered="true">
            <h:outputLabel id="NoResultMessage"
            value="#{messages.error_labelLookupCustomerForPricing_noResults}"
            style="color:red;float:left"
            rendered="#{customerHierarchy.noCustomer}" />
            </a4j:outputPanel>
            </h:panelGrid>
            <!-- Actual Content Area Start-->
            <rich:panel style="width:650px;" id="mainTab">
            <!-- Start Of Inside tab -->
            <!-- First Part Inside Tab -->
            <h:panelGrid id="LookupCustomerForPricing_searchPanelGrid"
            columns="8" width="90%">
            <h:outputLabel id="txtSearchFor"
            value="#{messages.labelLookupCustomerForPricing_SearchFor}"
            styleClass="inputClass" />
            <rich:spacer width="5" id="spacer1" />

            <h:selectOneMenu id="txtSearchForMenu" required="true"
            value="#{customerHierarchy.searchForCustomer}"
            styleClass="dropdown_list_font">
            <f:selectItems value="#{customerHierarchy.searchForList}" />
            </h:selectOneMenu>
            <rich:spacer width="5" id="spacer2" />

            <h:inputText id="txtcustomerId" maxlength="50" size="40"
            value="#{customerHierarchy.customerNameOrId}"
            validatorMessage="#{messages.error_labelLookupCustomerForPricing_MinimumRequired}" >
            <f:validator validatorId="splCharValidator" />
            <f:validateLength minimum="3" />
            </h:inputText>
            <a4j:outputPanel ajaxRendered="true">
            <rich:spacer width="1" id="spacer3" />
            <rm:message forId="txtcustomerId" image="../images/error.gif" />
            </a4j:outputPanel>
            <rich:spacer width="5" id="spacer4" />
            <a4j:commandButton id="searchBtnId"
            value="#{messages.labelLookupCustomerForPricing_Search}"
            styleClass="defaultbutton_style" style="align:center"
            action="#{customerHierarchy.searchCustomerByID}"
            reRender="LookupCustomerForPricing, errorMessage, LookupCustomerForPricing_inputDataGrid"
            limitToList="true"
            onclick="Richfaces.showModalPanel('progressBar')"
            oncomplete="Richfaces.hideModalPanel('progressBar')" />
            </h:panelGrid>
            <rich:spacer height="10" id="spacer6" />

            <h:panelGrid id="LookupCustomerForPricing_inputDataGrid">

            <rich:scrollableDataTable
            id="LookupCustomerForPricing_LookupDataTable"
            value="#{customerHierarchy.customerList}" var="lookupCustomer"
            height="250px" width="600px"
            columnClasses="columnClassCenter,columnClassCenter,columnClassLeft,columnClassCenter"
            rendered="#{not empty customerHierarchy.customerList}"
            rowClasses="rowColor1,rowColor2">
            <f:facet name="caption"><h:outputText /> </f:facet>
            <rich:column width="100px" styleClass="columnClassCenter"
            id="checkBoxColID" sortable="false"
            rendered="#{customerHierarchy.renderChkboxFlag}">
            <f:facet name="header">
            <h:outputText style="font-weight: bold"
            value="#{messages.labelMaintainRecipe_Select}" />
            </f:facet>
            <h:selectBooleanCheckbox value="#{lookupCustomer.checkFlag}"
            id="checkBoxId" />
            </rich:column>
            <rich:column width="105px">
            <f:facet name="header">
            <h:outputText id="customerTypeLabel" style="font-weight: bold"
            value="#{messages.labelLookupCustomerForPricing_CustomerType}" />
            </f:facet>

            <h:graphicImage id="image1" value="../images/u_dot.png"
            rendered="#{lookupCustomer.customerType == 0}" />
            <h:graphicImage id="image1_2" value="../images/f_dot.png"
            rendered="#{lookupCustomer.customerType == 3}" />
            <h:graphicImage id="image1_3" value="../images/p_dot.png"
            rendered="#{lookupCustomer.customerType == 5}" />
            </rich:column>

            <rich:column width="95px">
            <f:facet name="header">
            <h:outputText id="customerLabel" style="font-weight: bold"
            value="#{messages.labelLookupCustomerForPricing_Customer}" />
            </f:facet>

            <h:outputText id="txtCustomerNumber3"
            value="#{lookupCustomer.customerId}" />
            </rich:column>

            <rich:column width="285px">
            <f:facet name="header">
            <h:outputText id="customerNameLabel" style="font-weight: bold"
            value="#{messages.labelLookupCustomerForPricing_CustomerName}" />
            </f:facet>

            <h:outputText id="txtCustomerName3"
            value="#{lookupCustomer.customerName}" />
            </rich:column>

            <rich:column width="100px"
            rendered="#{!customerHierarchy.renderChkboxFlag}">
            <f:facet name="header">
            <h:outputText id="actionLabel" style="font-weight: bold"
            value="#{messages.labelLookupCustomerForPricing_Action}" />
            </f:facet>

            <a4j:commandLink id="commandLink1" styleClass="commandLink"
            action="#{customerHierarchy.populateSelectedCustomer}"
            onclick="Richfaces.showModalPanel('progressBar')"
            oncomplete="Richfaces.hideModalPanel('progressBar');Richfaces.hideModalPanel('LookupCustomerPricing');updateParentPage('#{customerHierarchy.fromPage}');">
            <a4j:commandButton id="btnSelect"
            value="#{messages.labelLookupCustomerForPricing_Select}"
            styleClass="button_style" style="align:center" />
            <f:param id="customerName" name="customerName"
            value="#{lookupCustomer.customerName}" />
            <f:param id="customerId" name="customerId"
            value="#{lookupCustomer.customerId}" />
            <f:param id="customerType" name="customerType"
            value="#{lookupCustomer.customerType}" />
            <f:param id="custNameFlag" name="custNameFlag" value="true" />
            </a4j:commandLink>
            </rich:column>

            </rich:scrollableDataTable>
            </h:panelGrid>
            </rich:panel>
            <h:panelGrid id="LookupCustomerForPricing_FooterGrid" columns="3"
            style="float:right">
            <a4j:commandButton id="btnOk" value="#{messages.btnAllPages_Ok}"
            action="#{customerHierarchy.populateSelectedCustomers}"
            rendered="#{customerHierarchy.renderChkboxFlag &amp;&amp; !empty customerHierarchy.customerList}"
            styleClass="button_style_width" style="align:center"
            onclick="Richfaces.showModalPanel('progressBar')"
            oncomplete="javascript:Richfaces.hideModalPanel('progressBar');hideLookupCustomerForPricingPopup('LookupCustomerPricing');updateParentPage('#{customerHierarchy.fromPage}');"
            reRender="errorCheckCustomerFlag,LookupCustomerForPricing" />
            <rich:spacer width="1"
            rendered="#{customerHierarchy.renderChkboxFlag}" />
            <a4j:commandButton id="btnCancel"
            value="#{messages.btnAllPages_Cancel}" styleClass="button_style"
            style="align:center" limitToList="true"
            onclick="javascript:Richfaces.hideModalPanel('LookupCustomerPricing')">
            </a4j:commandButton>
            </h:panelGrid>

            <rich:hotKey key="return" type="keypress"
            selector="#txtcustomerId"
            handler="#{rich:element('searchBtnId')}.click()"
            disableInInput="false" disableInInputTypes="" />

            </h:form>

            setHighlight('${highlight}');
            setFocus('${focus}');
            customerFocus();

            </f:subview>

            • 3. Re: rich:hotKey giving java script error
              ramki dirisala Novice

              actullay i am using hotkey somthing like this

              <rich:hotKey key="F10" handler="document.getElementById('includedPage:recipeIngredientsForm:empListTableEmpty:0:btnAdd').click()" />

              if i remove above code i am not getting any javascript error.


              is it possible to use function keys in side hotKey.

              thanks,
              ramki.

              • 4. Re: rich:hotKey giving java script error
                Ilya Shaikovsky Master

                 

                 <rich:hotKey key="f10" handler="enlarge('#{rich:clientId('pic')}');return false;"/>
                


                works just fine at richfaces demo. try to use onclick() instead of click and change the key to "f10"..