Any good tips on how to auto save the form while user is typing?
First thing you'll need is a
state column so when you click New, it creates a record in
draft state so you can save all the changes to it.
Then I would just add some JS to submit the form via AJAX every once in a while. GMail does it after you stop typing for a few seconds, or you move your cursor out of the text box for example. The exact details on this probably depend a bit upon what your form looks like.
Saving the draft changes is really just submitting a
PUT to the
update action because the record's in draft state, you can just use the regular
update. When you are ready to publish it, you can submit the new state or have a special
publish action if you wanted to do more with it.
This would be a great screencast. 👍
Yes Chris, I think this is a common feature now that it will be a great screencast! DO IT.
Join 18,000+ developers who get early access to new screencasts, articles, guides, updates, and more.