AutoSave in Visualforce + Calling an Apex Function from Javascript
4:31 PM
I had a couple of Visualforce Page forms. Each form had multiple input boxes for the user to input information.
I had a save button at the top and bottom of the page. But still, sometimes the user might accidentally close or navigate to some other page.
Auto Saving the page in regular intervals was so nice to have. To do this we will use with a mix of Javascript and Apex.
Create a Visualforce Page with the code below.
Create an Apex Class with the code as given below.
I had a save button at the top and bottom of the page. But still, sometimes the user might accidentally close or navigate to some other page.
Auto Saving the page in regular intervals was so nice to have. To do this we will use
Create an Apex Class with the code as given below.
7 comments
You can use window.setInterval instead of repeated calls to window.setTimeout, for efficiency purposes. Other than that, I love this idea.
ReplyDeleteYou don't need to use Apex here. Instead, bind apex:actionFunction to the standard controller's quicksave action.
ReplyDeleteNo Apex = no test code!
Very soon this website will be famous amid all blogging people, due to it's good articles or reviews
ReplyDeleteAlso see my page :: online kleidung shop
Hi sir, may i see the code. We've been working for that kind of functionality for weeks now. It would be a great help if you could at least make the codes visible ? Thank You very much.
ReplyDeleteSorry i commented on the wrong blog. My sincerest apologies.
DeleteYou can use actionPoller. It serves the purpose well.
ReplyDeleteHow do you deal with workflows / Validations / Flows and triggers while auto save, the data provided might be not sufficient enough to pass and throw exceptions?
ReplyDelete