+ Start a Discussion

problem while pressing enter key



When i press enter key in text box, it does not performing its operation and doing the command button action..how can i solve this...




<apex:inputText  id="pageno"   tabindex="1" size="1" onkeypress="return noenter(event);" value="{!setCon.pageNumber}" ></apex:inputText>


<apex:commandButton id="cmdnxt"  action="{!step2}" value="Next"  />


When i give input in input text field and hit enter its doing cmd button action.. i want to stop this and need to perform wat the work assigned for text box..


I would not reccomend using the onkeypress event because it is not fired for most control keys and it varies with each browser. Use the onkeydown or onkeyup events.