【发布时间】:2011-06-29 14:42:09
【问题描述】:
此页面在新窗口中打开。 我有一个文本框和两个按钮(h:commandbutton 和 a4j:commandButton)。
我将光标焦点移动(设置)到文本字段中。
我的问题是,我从文本字段中点击输入按钮,然后自动调用 h:comandButton 操作并关闭新窗口。如何避免这种情况。
但是,我需要,当我按下回车键时,将光标焦点移动到 a4j:commandButton
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function a4jButtonClick()
{
alert("A4J Command Buton clicked...");
}
</script>
</head>
<body>
<h:form id="sampleForm">
<rich:panel id="samplePanel">
<h:outputText value="User Name : "/>
<h:inputText/>
<h:commandButton value="Closing-CommandButton"
onclick="javascript:window.close();return false;"/>
<a4j:commandButton value="A4JCommandButton" onclick="a4jButtonClick()"/>
</rich:panel>
</h:form>
</body>
</html>
</f:view>
如果我从文本文件中按回车按钮,我想调用脚本警报(“A4J 命令按钮单击...”);
帮帮我。 提前致谢。
【问题讨论】:
标签: javascript jsf button command richfaces