import StickyForm
class StickyForm(Form) def __init__(self, cgi = None, state=None,**kw) string __module__ = 'StickyForm' def __str__(self) def restore(self,filename) def save(self,filename) def with_state(self,input) # Methods inherited by StickyForm from Form def append(self, *items)
Works like a Form with the addition of a state attribute, a save method and a restore method. A form's state is a FormState instance which holds the default values for all form elements.
save tells the FormState instance to save itself to a file.
restore tells the FormState instance to restore itself from a file.
Append any number of items to the form container.
Here's where the actual work gets done. Each Input, Select and Textarea object in the form is modified to reflect it's value as defined in the form's state.
form=StickyForm(state="/tmp/form.txt")
fs=cgi.FieldStorage() form=StickyForm(state=fs)
fs=FormState() form=StickyForm(state=fs)
Copyright © Amos Latteier
All Rights Reserved
Comments to author: amos@aracnet.com
Generated: Tue Apr 20, 1999