Hi,
The following page open in new window.
This apge have one text box and two button(h:commandbutton and a4j:commandButton).
I move(set) the cursor focus into textfield.
My problem is, i hit enter button from textfield, then automattically called h:comandButton action and closed new window. How to avoid this.
But, I need , when i hit enter button, move the cursor focus to <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(); />
<a4j:commandButton value="A4JCommandButton" onclick="a4jButtonClick()"/>
</rich:panel>
</h:form>
</body>
</html>
</f:view>
If i hit enter button from textfiled, i want to call the script alert("A4J Command Buton clicked...");
Help me.
Thank in advance.
Hi Eswara,
use an JavaScript in your onKeyPress-Method of your textfield to trigger a4j-Button.
Best regards,
Mark