CrowdTuesday Amsterdam Jan 20, 2015 by Crowdfundinghub - OnePlanetCrowd
Amsterdam PUN - 20-10-2011
-
Upload
vincentpsarga -
Category
Technology
-
view
886 -
download
4
description
Transcript of Amsterdam PUN - 20-10-2011
collective.autosaveformVincent Pretre - Zest softwarePUN 20/10/11 - Amsterdam
Friday, October 21, 2011
Friday, October 21, 2011
Friday, October 21, 2011
Friday, October 21, 2011
Friday, October 21, 2011
Friday, October 21, 2011
Saving events
• Input changed
• User clicks
• User (or user’s cat) hits key
• Every x seconds
Friday, October 21, 2011
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
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
Loading form
• compare local/remote database versions
• use most recent
• fills the form with saved data
Friday, October 21, 2011
Using autosave form1 - register form
from collective.autosaveform import configfrom 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: pass
Friday, October 21, 2011
Using autosave form2 - enable loading
<script type="text/javascript"> jq('#my_saved_form').autosaveform();</script>
Friday, October 21, 2011
Using autosave form3 - mark form
def process_form(...): # Process the form ... tool = getToolByName(context, 'portal_autosaveform' tool.mark_form_processed( 'my_saved_form')
Friday, October 21, 2011
Demo
Friday, October 21, 2011
Limitations
• Only works with logged-in users
• Only tested with custom forms (no Archetypes forms or z3cforms)
• Do not support file inputs
Friday, October 21, 2011
Advantages
• Configurable
• Server friendly
• User friendly
• Multi-browsers
• Supports all HTML inputs
Friday, October 21, 2011