You need to sign in to do that
Don't have an account?
Pressing Enter key then command button will execute
please help me...here is my code
<apex:page standardController="account" extensions="enterkeyclass">
<apex:form >
<script type='text/javascript'>
function noenter(ev) {
if (window.event && window.event.keyCode == 13 || ev.which == 13) {
doSearchAF();
return false;
} else {
return true;
}
}
</script>
<apex:pageBlock >
<apex:messages />
<apex:actionFunction name="doSearchAF" action="{!searchJobs}" />
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Search Jobs" action="{!searchJobs}" onkeypress="noenter(event);"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
---------------------
public class enterkeyclass {
Apexpages.Message mess;
public enterkeyclass(ApexPages.StandardController controller) {
}
public pagereference searchJobs(){
mess = new Apexpages.Message( Apexpages.Severity.ERROR,'No Results Found');
return null;
}
}
Hi,
Try this Piece of Code , This works correctly in my Developer Org. Please Hit Kudos if this provides some useful information and mark it as a Solution so that others with the same query could get the answers without paing much time.
Important :
Click on the Star Icon aside if this post provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You