1 Reply Latest reply on Feb 12, 2010 11:27 AM by Rodrigo Mendoza

    rich:inputNumberSpinner prevent the enter key by using oninputkeypress

    Rodrigo Mendoza Novice



      How can I avoid the enter key for the rich:inputNumberSpinner, I have try using oninputkeypress and calling a js like this


      <r:inputNumberSpinner id="spinnerPorcentajeComisionista" value="#{pedidoBBean.porcentajeComisionista}" maxValue="33" minValue="0" oninputkeypress="return stopRKey(event)" cycled="true" required="#{pedidoBBean.comisionistaPorcentajeRequired}" disabled="#{pedidoBBean.comisionistaPorcentajeDisabled}"/>


      this is the js function


      function stopRKey(evt) {

            var evt = (evt) ? evt : ((event) ? event : null);

            var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

            if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}




      But is not working, any help would be appreciated cause not even an alert I get using oninputkeypress, there is another way or I’m doing something wrong?