Welcome Guest, Not a member yet? Register   Sign In
AutoSave function
#1

[eluser]jeanv[/eluser]
Hi everyone,

i would like to try to implement a autoSave function on forms in CI, i found that very useful in Wordpress, i woud like to know more or less how it works. I don't ask anybody to do it for me, i will do it, but i imagine with a little help !

Well if someone has a point of view on that please let me know !

Bye
#2

[eluser]Gavin Blair[/eluser]
Your best bet in my humble opinion is to have a Javascript function that makes a Ajax call every x seconds to save your form data into the database.

You should look into jQuery for the Ajax.

Cheers
Gavin
#3

[eluser]ehicks727[/eluser]
You might want to dig into the actual Wordpress code and find out exactly how they do it! I could be wrong, but I think Wordpress uses TinyMCE, right?? I'll bet that the autosave is a feature of TinyMCE.
#4

[eluser]jeanv[/eluser]
hi, yes i was thinking about using one these two libraries, but i don't exactly see how it works, i mean it would be a call of a php script that insert the data of the form in a database by a javascript script. But how the php script can have the value of the input elements with submiting the form ?
#5

[eluser]jeanv[/eluser]
i found something interesting here: http://jetlogs.org/2007/11/11/auto-saving-with-jquery/ i think that with that i'm ok, thanks !
#6

[eluser]Gavin Blair[/eluser]
When you use Ajax with jQuery, you are sending the form values to a php file.

For instance, your autosave function can send the entire form's values to "autosave.php", or to your autosave controller "index.php/autosave/", and your php will just process $_POST and echo out a success message.

Experiment a little with Ajax and jQuery, it's really fun.
#7

[eluser]jeanv[/eluser]
ok i will try that, it does not seem that complicated




Theme © iAndrew 2016 - Forum software by © MyBB