function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Priyadarshini Manoharan 3Priyadarshini Manoharan 3 

Hitting enter key in password input text in custom login page of salesforce does not log you into salesforce. Is there some setting which logs the user in, once they enter password and hit the enter key

Best Answer chosen by Priyadarshini Manoharan 3
Amit Chaudhary 8Amit Chaudhary 8
Please check below post for same
http://www.sundoginteractive.com/sunblog/posts/clicking-a-specific-button-when-enter-is-pressed-salesforce

Example 1:-
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js">
</script>   
<script type="text/javascript">
       $j = jQuery.noConflict();
       $j(document).ready(function(){
             $j(".inputSearchText").keypress(function(event){
                if(event.keyCode == 13){
                    $j( ".searchByMe" ).click();
                    return false;
                 }
              });
      });
</script>  
 
<apex:inputText value="{!searchText}" style="width: 300px;" id="inputSearchText" styleclass="inputSearchText"></apex:inputText>
 
<apex:commandbutton value="Search" id="search1ID" styleclass="searchByMe" action="{!doSearch}" rerender="specialPanel"></apex:commandbutton>
Example 2:- 

<apex:inputText (your args) onkeydown="if(event.keyCode==13){this.blur();actionFunction();}" />

<apex:actionFunction name='actionFunction' action='{!doSearch}' />
http://developer.force.com/cookbook/recipe/submit-a-form-with-the-enter-key

Please let us know if this will help you.

Thanks
Amit Chaudhary

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please check below post for same
http://www.sundoginteractive.com/sunblog/posts/clicking-a-specific-button-when-enter-is-pressed-salesforce

Example 1:-
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js">
</script>   
<script type="text/javascript">
       $j = jQuery.noConflict();
       $j(document).ready(function(){
             $j(".inputSearchText").keypress(function(event){
                if(event.keyCode == 13){
                    $j( ".searchByMe" ).click();
                    return false;
                 }
              });
      });
</script>  
 
<apex:inputText value="{!searchText}" style="width: 300px;" id="inputSearchText" styleclass="inputSearchText"></apex:inputText>
 
<apex:commandbutton value="Search" id="search1ID" styleclass="searchByMe" action="{!doSearch}" rerender="specialPanel"></apex:commandbutton>
Example 2:- 

<apex:inputText (your args) onkeydown="if(event.keyCode==13){this.blur();actionFunction();}" />

<apex:actionFunction name='actionFunction' action='{!doSearch}' />
http://developer.force.com/cookbook/recipe/submit-a-form-with-the-enter-key

Please let us know if this will help you.

Thanks
Amit Chaudhary
This was selected as the best answer
Priyadarshini Manoharan 3Priyadarshini Manoharan 3
Hi Amit,

I think this should help. Let me try out and keep you posted.

Thanks and Regards
Priya
Priyadarshini Manoharan 3Priyadarshini Manoharan 3
Hi Amit,

I used the second approach and it worked fine for me.

Thanks and Regards
Priya