1 Reply Latest reply on Nov 7, 2008 1:29 PM by supernovasoftware.com

    How to rich:hotKey to click button

      I am experimenting with rich:hotKey and I would like this to simulate an a4j:commandButton click.

      Below is code that opens a modal panel after calling an action.

      I got this to work with a combination of a4j:jsFunction and rich:hotKey, but I would rather just simulate a click to the button so I do not have to duplicate the action, oncomplete, status, and reRender in the a4j:jsFunction declaration.

      At the bottom of my code sample I tried to get this to work with Event.fire, but it did not work.

      I would greatly appreciate any advice on how to make this work.

      <a4j:commandButton status="commonstatus0"
       id="createPipePO"
       title="Create PO"
       value="Create PO"
       style="background: transparent; border-style: none;"
       immediate="true"
       action="#{poPipeForm.loadNew}"
       oncomplete="javascript:Richfaces.showModalPanel('editPOPanel',{left:'auto', top:'auto'});"
       reRender="editPOForm" />
      
       <!-- This works, but I have to duplicate action, oncomplete, status, and reRender -->
       <a4j:jsFunction name="poPipeForm_loadNew"
       action="#{poPipeForm.loadNew}"
       oncomplete="Richfaces.showModalPanel('editPOPanel',{left:'auto', top:'auto'});return false;"
       status="commonstatus0"
       reRender="editPOForm" />
       <rich:hotKey key="alt+ctrl+p"
       handler="poPipeForm_loadNew();return false;"/>
      
       <!-- This is not working at all -->
       <rich:hotKey key="alt+ctrl+o"
       handler="Event.fire(#{rich:element('createPipePO')}, 'a4j:commandButton:onclick');return false;"/>