jsf - submit form when p:commandbutton click -


i using primefaces in jsf web application. in order user inputs have used primefaces keyboard component , it's working fine. issue after getting user input keyboard component , click on commandbutton cause page reload.

<p:keyboard id="default" value="#{paymentbean.mobilenumber}" keypadonly="true" size="50" for="numberinput" />  <p:commandbutton id="enternotebtn" action="#{paymentbean.validatepayment()}" value="#{msg['billpayment.cash.message']}"                              onclick="onenternotebtn();" async="true" /> 

but when using primefaces inputtext instead of keyboard component not cause page reload.

<p:inputtext id="numberinput" value="#{paymentbean.mobilenumber}"  autocomplete="off" />  <p:commandbutton id="enternotebtn" action="#{paymentbean.validatepayment()}" value="#{msg['billpayment.cash.message']}"                              onclick="onenternotebtn();" async="true" /> 

i want figure out reason behavior (i using primefaces version 5.3.1).

update :

i have found cause page submit javascript function invoke on button click.

function onenternotebtn(){     var number = document.getelementbyid("cashform:numberinput").value; } 

this causing form submit because of invalid id.

thanks.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -