Hi,
I use rich:inputNumberSpinner tag.
The problem is :
I set cursor focus to inside of rich:inputNumberSpinner field, then i hit the enter button from my keyboard, that time page will be automatically refresh.
But i don't need page refresh when i hit the enter button from my keyboard.
The code :
spinnerTagTest.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
<body>
<h:form id="SpinnerForm">
<rich:inputNumberSpinner id="spinnerField" value="" />
</h:form>
</body> </html></f:view>
I also use rich:hotKey for that inputNumberSpinner field. But Page refreshed.
<rich:hotKey key="return"
selector="#spinnerField"
handler="event.stopPropagation();event.preventDefault();
return false;"/>
And i check anotherway using javasccript, but page refreshed.
The specific tag and javascript is :
<rich:inputNumberSpinner id="spinnerField" value=""
oninputkeypress="return stopPageRefresh();"/>
<script type="text/javascript">
function stopPageRefresh()
{
return false;
}
</script>
Here i use one alert message inside of stopPageRefresh().
But i hit enter button, first page refreshing and then alert message displayed.
Help me about this. Thanks in advance.