doc/book/en/development/devweb/form.rst
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Thu, 08 Apr 2010 17:50:37 +0200
branchstable
changeset 5189 84d4587a92bc
parent 4743 026a89520184
child 5350 49c065ae225e
permissions -rw-r--r--
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)

Form construction
------------------

CubicWeb provides usual form/field/widget/renderer abstraction to
provde some generic building blocks which will greatly help you in
building forms properly integrated with CubicWeb (coherent display,
error handling, etc...).

A form basically only holds a set of fields, and has te be bound to a
renderer which is responsible to layout them. Each field is bound to a
widget that will be used to fill in value(s) for that field (at form
generation time) and 'decode' (fetch and give a proper Python type to)
values sent back by the browser.

The Field class and basic fields
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: cubicweb.web.formfields.Field

Existing field types are:

.. autoclass:: cubicweb.web.formfields.StringField
.. autoclass:: cubicweb.web.formfields.PasswordField
.. autoclass:: cubicweb.web.formfields.RichTextField
.. autoclass:: cubicweb.web.formfields.FileField
.. autoclass:: cubicweb.web.formfields.EditableFileField
.. autoclass:: cubicweb.web.formfields.IntField
.. autoclass:: cubicweb.web.formfields.BooleanField
.. autoclass:: cubicweb.web.formfields.FloatField
.. autoclass:: cubicweb.web.formfields.DateField
.. autoclass:: cubicweb.web.formfields.DateTimeField
.. autoclass:: cubicweb.web.formfields.TimeField
.. autoclass:: cubicweb.web.formfields.RelationField
.. autoclass:: cubicweb.web.formfields.CompoundField


Widgets
~~~~~~~
Base class for widget is :class:cubicweb.web.formwidgets.FieldWidget class.

Existing widget types are:

.. autoclass:: cubicweb.web.formwidgets.HiddenInput
.. autoclass:: cubicweb.web.formwidgets.TextInput
.. autoclass:: cubicweb.web.formwidgets.PasswordInput
.. autoclass:: cubicweb.web.formwidgets.PasswordSingleInput
.. autoclass:: cubicweb.web.formwidgets.FileInput
.. autoclass:: cubicweb.web.formwidgets.ButtonInput
.. autoclass:: cubicweb.web.formwidgets.TextArea
.. autoclass:: cubicweb.web.formwidgets.FCKEditor
.. autoclass:: cubicweb.web.formwidgets.Select
.. autoclass:: cubicweb.web.formwidgets.CheckBox
.. autoclass:: cubicweb.web.formwidgets.Radio
.. autoclass:: cubicweb.web.formwidgets.DateTimePicker
.. autoclass:: cubicweb.web.formwidgets.JQueryDateTimePicker
.. autoclass:: cubicweb.web.formwidgets.JQueryDatePicker
.. autoclass:: cubicweb.web.formwidgets.JQueryTimePicker
.. autoclass:: cubicweb.web.formwidgets.AjaxWidget
.. autoclass:: cubicweb.web.formwidgets.AutoCompletionWidget
.. autoclass:: cubicweb.web.formwidgets.EditableURLWidget

Other classes in this module, which are not proper widget (they are not associated to
field) but are used as form controls, may also be useful: Button, SubmitButton,
ResetButton, ImgButton,


Of course you can not use any widget with any field...

Renderers
~~~~~~~~~

.. autoclass:: cubicweb.web.views.formrenderers.BaseFormRenderer
.. autoclass:: cubicweb.web.views.formrenderers.HTableFormRenderer
.. autoclass:: cubicweb.web.views.formrenderers.EntityCompositeFormRenderer
.. autoclass:: cubicweb.web.views.formrenderers.EntityFormRenderer
.. autoclass:: cubicweb.web.views.formrenderers.EntityInlinedFormRenderer