13 Replies Latest reply: Apr 9, 2014 6:06 AM by Rudi Strasser RSS

How to stop page refresh when hit enter button from rich:inputNumberSpinner field?

Eswara MoorthyNEC Newbie


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.



          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">          

      <h:form id="SpinnerForm">
           <rich:panel id="SpinnerPanel">                
             <rich:inputNumberSpinner id="spinnerField" value="" maxValue="23" inputSize="2"/>                                         

I also used rich:hotKey for inputNumberSpinner field. But Page refreshed.

<rich:hotKey key="return"
             return false;"/>

And i test anotherway using javascript, but page refreshed.

The specific tag and javascript is :

<rich:inputNumberSpinner id="spinnerField"  value="" maxValue="23" inputSize="2"
                         oninputkeypress="return stopPageRefresh();"/>

<script type="text/javascript">

    function stopPageRefresh()
        alert("Stop Page refresh called");    
        return false;

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.