Amsterdam PUN - 20-10-2011

1,246 views

Published on

Presentation of collective.autosaveform at PUN (Python Users Netherlands)

Published in: Technology, Travel
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,246
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Amsterdam PUN - 20-10-2011

  1. 1. collective.autosaveform Vincent Pretre - Zest software PUN 20/10/11 - AmsterdamFriday, October 21, 2011
  2. 2. Friday, October 21, 2011
  3. 3. Friday, October 21, 2011
  4. 4. Friday, October 21, 2011
  5. 5. Friday, October 21, 2011
  6. 6. Friday, October 21, 2011
  7. 7. Saving events • Input changed • User clicks • User (or user’s cat) hits key • Every x secondsFriday, October 21, 2011
  8. 8. Saving form - local • Use localstorage • Fake dictionaries [my_form][an_input] = ’10’ [my_form][multi_input][count] = ‘2’ [my_form][multi_input][values][0] = ‘bli’ [my_form][multi_input][values][1] = ‘bla’Friday, October 21, 2011
  9. 9. Saving form - remote • Every 10 local saves • jQuery Ajax call • data saved as annotations in portal_autosaveform [my_form][an_input] = ’10’ [my_form][multi_input][values] = [‘bli’, ‘bla’]Friday, October 21, 2011
  10. 10. Loading form • compare local/remote database versions • use most recent • fills the form with saved dataFriday, October 21, 2011
  11. 11. Using autosave form 1 - register form from collective.autosaveform import config from Products.CMFCore.utils import getToolByName tool = getToolByName(context, portal_autosaveform) try: tool.register_form(my_saved_form, {text_field: config.TEXT, radio_field: config.RADIO}) except: passFriday, October 21, 2011
  12. 12. Using autosave form 2 - enable loading <script type="text/javascript"> jq(#my_saved_form).autosaveform(); </script>Friday, October 21, 2011
  13. 13. Using autosave form 3 - mark form def process_form(...): # Process the form ... tool = getToolByName(context, portal_autosaveform tool.mark_form_processed( my_saved_form)Friday, October 21, 2011
  14. 14. DemoFriday, October 21, 2011
  15. 15. Limitations • Only works with logged-in users • Only tested with custom forms (no Archetypes forms or z3cforms) • Do not support file inputsFriday, October 21, 2011
  16. 16. Advantages • Configurable • Server friendly • User friendly • Multi-browsers • Supports all HTML inputsFriday, October 21, 2011

×