1

我想在按下回车键时执行一个按钮,但不知何故这不起作用:

<f:view>
 <h:body>
   <h1>#{bv.title}</h1>
   <h2>#{bv.version}</h2>
   <h:panelGrid columns="2">
    <h:form id="searchForm">
......
<f:facet name="footer">
       <h:panelGroup style="display:block; text-align:left">
        <h:commandButton style="font-size: large;" id="create" value="#{bv.buttonCreate}" action="#{search.create}" />
        <h:commandButton style="font-size: large;" id="clear" value="#{bv.buttonReset}" action="#{search.clear}" immediate="true" /><br/>
        <h:commandButton style="font-size: large;" id="pdf" rendered="#{search.jpgRendered}" immediate="true" action="#{search.openPDF}" value="Drucken als PDF" />
        <rich:hotKey key="return"
                         selector="#searchForm"
                         handler="#{rich:element('searchForm:create')}.click();
                         event.stopPropagation();event.preventDefault();
                         return false;"/>
       </h:panelGroup>
      </f:facet>

知道为什么这不起作用吗?

谢谢!

4

1 回答 1

1

handler属性应该是 JS 函数的名称,而不是函数本身 ( docs )。也就是说,如果您使用的是 RF3,则 RF4 没有处理程序属性。

编辑:对于 RF4,有onkeyuponkeydown属性相同(文档),但您可以选择何时触发动作。

于 2013-09-30T09:38:13.873 回答