### Class StickyForm

## SYNOPSIS

    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)

## DESCRIPTION

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.

### def append(self, *items)

Append any number of items to the form container.

### def with_state(self,input)

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.

## You can initalize the state 3 ways, with a:

filename
  this loads the state of the form from a file
FieldStorage
  this sets the state of the form from the information in the FieldStorage
FormState
  this sets the state to the FormState instance

## For example:

       form=StickyForm(state="/tmp/form.txt")

       fs=cgi.FieldStorage()
       form=StickyForm(state=fs)

       fs=FormState()
       form=StickyForm(state=fs)

## SEE ALSO

StickyForm

Form

Copyright © Amos Latteier
All Rights Reserved
Comments to author: amos@aracnet.com
Generated: Tue Apr 20, 1999