# HG changeset patch # User Sylvain Thénault # Date 1248972564 -7200 # Node ID 9c414dbc76daa00741c2c4723bc3a5a548907271 # Parent 58556f9317c987bf4aeff5c6d48b0ceff2a44d5f add default values for fielsets_in_order, document base form attributes diff -r 58556f9317c9 -r 9c414dbc76da web/views/forms.py --- a/web/views/forms.py Thu Jul 30 15:19:29 2009 +0200 +++ b/web/views/forms.py Thu Jul 30 18:49:24 2009 +0200 @@ -20,16 +20,49 @@ class FieldsForm(form.Form): + """base class for fields based forms. + + The following attributes may be either set on subclasses or given on + form selection to customize the generated form: + + * `needs_js`: sequence of javascript files that should be added to handle + this form (through `req.add_js`) + + * `needs_css`: sequence of css files that should be added to handle this + form (through `req.add_css`) + + * `domid`: value for the "id" attribute of the
tag + + * `action`: value for the "action" attribute of the tag + + * `onsubmit`: value for the "onsubmit" attribute of the tag + + * `cssclass`: value for the "class" attribute of the tag + + * `cssstyle`: value for the "style" attribute of the tag + + * `cwtarget`: value for the "cubicweb:target" attribute of the tag + + * `redirect_path`: relative to redirect to after submitting the form + + * `copy_nav_params`: flag telling if navigation paramenters should be copied + back in hidden input + + * `form_buttons`: form buttons sequence (button widgets instances) + + * `form_renderer_id`: id of the form renderer to use to render the form + + * `fieldsets_in_order`: fieldset name sequence, to control order + """ id = 'base' is_subform = False + internal_fields = ('__errorurl',) + NAV_FORM_PARAMETERS - # attributes overrideable through __init__ - internal_fields = ('__errorurl',) + NAV_FORM_PARAMETERS + # attributes overrideable by subclasses or through __init__ needs_js = ('cubicweb.ajax.js', 'cubicweb.edition.js',) needs_css = ('cubicweb.form.css',) domid = 'form' - title = None action = None onsubmit = "return freezeFormButtons('%(domid)s');" cssclass = None @@ -37,8 +70,9 @@ cwtarget = None redirect_path = None copy_nav_params = False - form_buttons = None # form buttons (button widgets instances) + form_buttons = None form_renderer_id = 'default' + fieldsets_in_order = None def __init__(self, req, rset=None, row=None, col=None, submitmsg=None, mainform=True,