spyce
home
license
community
download
examples
resources
wishlist
contrib (@sf)
documentation
intro
lang
runtime
modules
tags
install
exits
sourceforge
statistics
freshmeat

Documentation - Tags
[[ Spyce ]]
Python Server Pages
by Rimon Barr

Prev: 5.1 - Core Up: 5 - Tags Next: 5.3 - Writing Tag Libraries

5.2. Form

The form active tag library is designed to simplify the generation of forms. The tags in this library closely follow the names of HTML form tags. The active tags automatically look up the appropriate data values or defaults. In time, more tags will be added for server-side verification.

  • <form [method=expr] [action=expr] [value=expr] [default=expr] ...> </form>
    Begin a new form. The method parameter is optional and defaults to 'GET'. The action is evaluated in the tag context. Both parameters are emitted. The value parameter is a dictionary of values, which overrides any submitted form values. The default parameter is a dictionary of values that is overridden by any submitted values.
  • <submit [name=expr] [value=expr] ... />
    Create a submit button. The name and value parameters are evaluated within the tag context and emitted.
  • <hidden name=expr [value=expr] [default=expr] .../>
    Create a hidden form field. The name parameter is evaluated and emitted. Both the value and default optional parameters are expressions and are evaluated. The value emitted is, in order of decreasing priority: local tag value, form tag value, value in submitted request dictionary, local tag default, form tag default. We search this list for the first non-None value.
  • <text name=expr [value=expr] [default=expr] [size=expr] [maxlength=expr] .../>
    Create a form text field. The name parameter is evaluated and emitted. Both the value and default optional parameters are expressions and are evaluated. The value emitted is, in order of decreasing priority: local tag value, form tag value, value in submitted request dictionary, local tag default, form tag default. We search this list for the first non-None value. The size and maxlength optional parameters are evaluated and emitted.
  • <password name=expr [value=expr] [default=expr] [size=expr] [maxlength=expr] .../>
    Create a form password field. Parameters are the same as for text fields, explained above.
  • <textarea name=expr [value=expr] [rows=expr] [cols=expr] ...>default</textarea>
    Create a form textarea field. The name parameter is evaluated and emitted. The value optional parameter is evaluated. A default may be provided in the body of the tag. The value emitted is, in order of decreasing priority: local tag value, form tag value, value in submitted request dictionary, local tag default, form tag default. We search this list for the first non-None value. The rows and cols optional parameters are evaluated and emitted.
  • <radio name=expr value=expr [checked] [default] .../>
    Create a form radio-box. The name and value parameters are evaluated and emitted. A checked and default flags affect whether this box is checked. The box is checked based on the following values, in decreasing order of priority: local tag value, form tag value, value in submitted request dictionary, local tag default, form tag default. We search this list for the first non-None value.
  • <checkbox name=expr value=expr [checked] [default] .../>
    Create a form check-box. Parameters are the same as for radio fields, explained above.
  • <select name=expr [value=expr] [default=expr] [multiple] [size=expr] ...>...</select>
    Create a form select block. The name parameter and the optional size parameters are evaluated and emitted. The value and default optional parameters are evaluated and serve to select the nested option fields. The multiple flag sets whether multiple selections are allowed.
  • <option [text=expr] [value=expr] [selected] [default] .../>
    <option [value=expr] [selected] [default] ...>text</option>
    Create a form selection option. This tag must be nested within a select tag. The text optional parameter is evaluated and emitted in the body of the tag. It can also be provided in the body of the tag, as per the HTML standard. The optional value parameter is evaluated and emitted. The selected and default flags determine which options are selected. The options is selected based on the following values, in decreasing order of priority: local tag value, select tag value, form tag value, value in submitted request dictionary, local tag default, select tag default, form tag default. We search this list for the first non-None value.


Prev: 5.1 - Core Up: 5 - Tags Next: 5.3 - Writing Tag Libraries


© 2002-05 Rimon Barr
email: rimon@acm.org
Spyce Powered SourceForge Logo [[ Spyce ]]
Python Server Pages
version 1.3.13