【发布时间】:2012-04-23 22:47:52
【问题描述】:
我有一个页面,其中 a4j:commandbutton 捕获 2 个文本框的值。文本框的值默认是这样的:
<a4j:region id="pnreg" >
<h:inputText id="pn" binding="#{bean.pn}"
value="Enter Number..."
onclick="clickclear(this, 'Enter Number...')"/>
</a4j:region>
</td>
<td width="20">
<a4j:region id="qtyreg" >
<h:inputText value="Enter Part Qty..." id="qty" binding="#{bean.qty}"
onclick="clickclear(this, 'Enter Qty...')"/>
</a4j:region>
</td>
<td width="20%">
<a4j:commandButton id="addPart" render="pn,qty" value="Add Part"
action="#{bean.submit}" />
当页面第一次加载时,文本框显示默认值,当用户点击它们时,这些值被清除为编码。单击按钮时,我希望文本框返回默认值。使用 jquery 我想我需要添加一个点击事件处理程序,但是richfaces api 已经有一个附加到 a4j:commandbutton 的事件处理程序。如何使我的 jquery 事件处理程序与richfaces 事件处理程序一起工作?谢谢。
【问题讨论】:
-
在普通的 HTML 中使用表单和输入,这通过简单地创建一个类型为“reset”的输入来完成,它将显示为一个按钮。