You need to sign in to do that
Don't have an account?
Keep focus on field after Save
I'm using a visual force page with an extended controller. When I click on the 'Save Only' button the page reloads to the top. How can I keep the focus on the field that a user was on prior to saving ? I am using the save action on the standard controller, not the extended controller.
<apex:page id="page" standardController="Comm_Auto_Audit_Sample_Policy__c" extensions="AuditCommAutoPolicySampleController" > ..... <apex:commandButton styleClass="myClass" value="Save Only" action="{!Save}"/> <apex:commandButton styleClass="myClass" value="Save and Return to Template" action="{!saveAndReturn}"/>
You can reRender the section, although it would not refresh the page but yes you can lost the focus on the field that a user was prior to saving. I am curious to know why you want to focus on that field. Use reRender like this: Let me know, if you need any other help.
Thanks,
Neetu
I believe that reRender of the Page will do the same thing.... loading the top of page.
Any suggestions on how to retain the focus on the field contining the cursor. I'm almost thinking we will need to use a save method on the extended controller but prefer to keep things simple.
In this case, reRender will resolve your problem and the page will not load. You can do some javascript coding, to put the focus to next field. I can help you on that. But for this I need the credentials, you can contact me either on my Gmail Id: neetu.bansal.5@gmail.com or Skype Id: neetu.bansal.5
Thanks,
Neetu
Here is the small Example to store the element id when mouse over and focusing after the Add method is completed.
Please let me know if you need any other help.
Thanks,
Pramodh.
The oncomplete action is uniues to the Visualforce commandButton, correct ? I did not see any jscript recference to it. How does the oncomplete="focusComplete();" keep the field refrence if the page is reloaded ? Doesn't it loose the refference to the field ?
Also, why are you pulling in the following?
<script src="/soap/ajax/30.0/connection.js" type="text/javascript"></script>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" />
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" />
https://developer.salesforce.com/docs/atlas.en-us.ajax.meta/ajax/sforce_api_ajax_connecting.htm
I placed the following code but the page still loads to the top and does not move down to the field I was on 'Service_Operation__c' in this case. Even if I declare all SOAP request .
Thanks
Alex