web/formwidgets.py
changeset 6882 b5e34836f84e
parent 6737 de49060d4be3
parent 6880 4be32427b2b9
child 6931 0af44a38fe41
equal deleted inserted replaced
6856:ac092197c099 6882:b5e34836f84e
    26 
    26 
    27    Of course you can not use any widget with any field...
    27    Of course you can not use any widget with any field...
    28 
    28 
    29 .. autoclass:: cubicweb.web.formwidgets.FieldWidget
    29 .. autoclass:: cubicweb.web.formwidgets.FieldWidget
    30 
    30 
       
    31 
    31 HTML <input> based widgets
    32 HTML <input> based widgets
    32 ''''''''''''''''''''''''''
    33 ''''''''''''''''''''''''''
    33 
    34 
    34 .. autoclass:: cubicweb.web.formwidgets.HiddenInput
    35 .. autoclass:: cubicweb.web.formwidgets.HiddenInput
    35 .. autoclass:: cubicweb.web.formwidgets.TextInput
    36 .. autoclass:: cubicweb.web.formwidgets.TextInput
    36 .. autoclass:: cubicweb.web.formwidgets.PasswordSingleInput
    37 .. autoclass:: cubicweb.web.formwidgets.PasswordSingleInput
    37 .. autoclass:: cubicweb.web.formwidgets.FileInput
    38 .. autoclass:: cubicweb.web.formwidgets.FileInput
    38 .. autoclass:: cubicweb.web.formwidgets.ButtonInput
    39 .. autoclass:: cubicweb.web.formwidgets.ButtonInput
    39 
    40 
       
    41 
    40 Other standard HTML widgets
    42 Other standard HTML widgets
    41 '''''''''''''''''''''''''''
    43 '''''''''''''''''''''''''''
    42 
    44 
    43 .. autoclass:: cubicweb.web.formwidgets.TextArea
    45 .. autoclass:: cubicweb.web.formwidgets.TextArea
    44 .. autoclass:: cubicweb.web.formwidgets.Select
    46 .. autoclass:: cubicweb.web.formwidgets.Select
    45 .. autoclass:: cubicweb.web.formwidgets.CheckBox
    47 .. autoclass:: cubicweb.web.formwidgets.CheckBox
    46 .. autoclass:: cubicweb.web.formwidgets.Radio
    48 .. autoclass:: cubicweb.web.formwidgets.Radio
    47 
    49 
       
    50 
    48 Date and time widgets
    51 Date and time widgets
    49 '''''''''''''''''''''
    52 '''''''''''''''''''''
    50 
    53 
    51 .. autoclass:: cubicweb.web.formwidgets.DateTimePicker
    54 .. autoclass:: cubicweb.web.formwidgets.DateTimePicker
    52 .. autoclass:: cubicweb.web.formwidgets.JQueryDateTimePicker
    55 .. autoclass:: cubicweb.web.formwidgets.JQueryDateTimePicker
    53 .. autoclass:: cubicweb.web.formwidgets.JQueryDatePicker
    56 .. autoclass:: cubicweb.web.formwidgets.JQueryDatePicker
    54 .. autoclass:: cubicweb.web.formwidgets.JQueryTimePicker
    57 .. autoclass:: cubicweb.web.formwidgets.JQueryTimePicker
    55 
    58 
       
    59 
    56 Ajax / javascript widgets
    60 Ajax / javascript widgets
    57 '''''''''''''''''''''''''
    61 '''''''''''''''''''''''''
    58 
    62 
    59 .. autoclass:: cubicweb.web.formwidgets.FCKEditor
    63 .. autoclass:: cubicweb.web.formwidgets.FCKEditor
    60 .. autoclass:: cubicweb.web.formwidgets.AjaxWidget
    64 .. autoclass:: cubicweb.web.formwidgets.AjaxWidget
    62 
    66 
    63 .. kill or document StaticFileAutoCompletionWidget
    67 .. kill or document StaticFileAutoCompletionWidget
    64 .. kill or document LazyRestrictedAutoCompletionWidget
    68 .. kill or document LazyRestrictedAutoCompletionWidget
    65 .. kill or document RestrictedAutoCompletionWidget
    69 .. kill or document RestrictedAutoCompletionWidget
    66 
    70 
       
    71 
    67 Other widgets
    72 Other widgets
    68 '''''''''''''
    73 '''''''''''''
       
    74 
    69 .. autoclass:: cubicweb.web.formwidgets.PasswordInput
    75 .. autoclass:: cubicweb.web.formwidgets.PasswordInput
    70 .. autoclass:: cubicweb.web.formwidgets.IntervalWidget
    76 .. autoclass:: cubicweb.web.formwidgets.IntervalWidget
    71 .. autoclass:: cubicweb.web.formwidgets.HorizontalLayoutWidget
    77 .. autoclass:: cubicweb.web.formwidgets.HorizontalLayoutWidget
    72 .. autoclass:: cubicweb.web.formwidgets.EditableURLWidget
    78 .. autoclass:: cubicweb.web.formwidgets.EditableURLWidget
    73 
    79 
       
    80 
    74 Form controls
    81 Form controls
    75 '''''''''''''
    82 '''''''''''''
    76 Those classes are not proper widget (they are not associated to
    83 
    77 field) but are used as form controls. Their API is similar
    84 Those classes are not proper widget (they are not associated to field) but are
    78 to widgets except that `field` argument given to :meth:`render`
    85 used as form controls. Their API is similar to widgets except that `field`
    79 will be `None`.
    86 argument given to :meth:`render` will be `None`.
    80 
    87 
    81 .. autoclass:: cubicweb.web.formwidgets.Button
    88 .. autoclass:: cubicweb.web.formwidgets.Button
    82 .. autoclass:: cubicweb.web.formwidgets.SubmitButton
    89 .. autoclass:: cubicweb.web.formwidgets.SubmitButton
    83 .. autoclass:: cubicweb.web.formwidgets.ResetButton
    90 .. autoclass:: cubicweb.web.formwidgets.ResetButton
    84 .. autoclass:: cubicweb.web.formwidgets.ImgButton
    91 .. autoclass:: cubicweb.web.formwidgets.ImgButton
   105     Here are standard attributes of a widget, that may be set on concret
   112     Here are standard attributes of a widget, that may be set on concret
   106     class to override default behaviours:
   113     class to override default behaviours:
   107 
   114 
   108     :attr:`needs_js`
   115     :attr:`needs_js`
   109        list of javascript files needed by the widget.
   116        list of javascript files needed by the widget.
       
   117 
   110     :attr:`needs_css`
   118     :attr:`needs_css`
   111        list of css files needed by the widget.
   119        list of css files needed by the widget.
       
   120 
   112     :attr:`setdomid`
   121     :attr:`setdomid`
   113        flag telling if HTML DOM identifier should be set on input.
   122        flag telling if HTML DOM identifier should be set on input.
       
   123 
   114     :attr:`settabindex`
   124     :attr:`settabindex`
   115        flag telling if HTML tabindex attribute of inputs should be set.
   125        flag telling if HTML tabindex attribute of inputs should be set.
       
   126 
   116     :attr:`suffix`
   127     :attr:`suffix`
   117        string to use a suffix when generating input, to ease usage as a
   128        string to use a suffix when generating input, to ease usage as a
   118        sub-widgets (eg widget used by another widget)
   129        sub-widgets (eg widget used by another widget)
       
   130 
   119     :attr:`vocabulary_widget`
   131     :attr:`vocabulary_widget`
   120        flag telling if this widget expect a vocabulary
   132        flag telling if this widget expect a vocabulary
   121 
   133 
   122     Also, widget instances takes as first argument a `attrs` dictionary which
   134     Also, widget instances takes as first argument a `attrs` dictionary which
   123     will be stored in the attribute of the same name. It contains HTML
   135     will be stored in the attribute of the same name. It contains HTML
   210 
   222 
   211         3. extra form values given to form.render call (specified the code
   223         3. extra form values given to form.render call (specified the code
   212            generating the form)
   224            generating the form)
   213 
   225 
   214         4. field's typed value (returned by its
   226         4. field's typed value (returned by its
   215           :meth:`~cubicweb.web.formfields.Field.typed_value` method)
   227            :meth:`~cubicweb.web.formfields.Field.typed_value` method)
   216 
   228 
   217         Values found in 1. and 2. are expected te be already some 'display
   229         Values found in 1. and 2. are expected te be already some 'display
   218         value' (eg a string) while those found in 3. and 4. are expected to be
   230         value' (eg a string) while those found in 3. and 4. are expected to be
   219         correctly typed value.
   231         correctly typed value.
   220 
   232