Thursday, June 25, 2015

Implement a instant saving on edit form

Hello everyone, I had to implement automatic saving on the various edit forms on the webapp I'm working on. The purpose is (I guess) to avoid lost of data if the user move from the edit page without saving first.

I know that is a problem that concern more the client side than the server side, but I'm writing here to get your opinion.

I thought about few possible solutions.

1)
add an alert message if the user try to go away from the form without saving. (rejected because if the user close the browser or BSOD...)

2)
_ add an ajax call after every "blur" event[1] to save the new edit. (Adding a control to detect an effective edit and avoid unnecessary ajax calls)

_ modify the view to save and return only the form if the request.is_ajax()
 
I have to implement the functionality for one form, I can use a mixin in the view for that (I already have one somewhere buried in my app.. :D :D), I have to figure out how to do the same in JS (smartly as in python...) 

Do you have any suggestions?

Thanks
​ 

Links:
[1] https://developer.mozilla.org/en-US/docs/Web/Events/blur
 

"if I have seen further, it is by standing on the shoulders of giants  -- Isaac Newton"

--
Karim N. Gorjux

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACeuRGWCuV4naZsqbgLy3A_vyWdYmOuc7%2B0bg-UzMujZ4Tkt3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment