Skip to content
Snippets Groups Projects
Solid-Form.rst 2.06 KiB
Newer Older
.. _solid-form:
solid-form
==========

Receives the URL of a ressource via its ``data-src`` attribute, and
displays a form to edit the resource. If given the URL of a container of
ressources, and displays a creation form to add a resource to the
container.

.. code:: html

   <solid-form data-src="http://localhost:8000/todos/"></solid-form>
Matthieu Fesselier's avatar
Matthieu Fesselier committed
Mixins
------

This component uses the following mixins:
   * :ref:`next-mixin <next-mixin>`
   * :ref:`store-mixin <store-mixin>`
   * :ref:`widget-mixin <widget-mixin>`
Matthieu Fesselier's avatar
Matthieu Fesselier committed

Please check their documentation to know more about their capabilities.

Attributes
----------
``label-xyz``
~~~~~~~~~~~~~
   When displaying a form, the default labels are the fields names of the model.
   If you want something fancier, you can set this attribute.
   i.e. ``label-username="Your name"``

``naked``
~~~~~~~~~
   When the attribute is set, the submit button will be
   removed. It’s particularly useful to prevent the nested forms to
   display their own submit button.

``upload-url-xyz``
~~~~~~~~~~~~~~~~~~
   URL to upload file for field ``xyz``, it
   automatically set ``widget-xyz`` to ``solid-form-file`` if net defined.
   It’s particularly useful with a dropdown field.

``submit-button``
~~~~~~~~~~~~~~~~~
   Text of the submit button of the form.

``range-xyz``
~~~~~~~~~~~~~
   URL of a container which list the accepted values
   for the field ``xyz``. It’s particularly useful with a dropdown
   field.
``order-asc-xyz`` or ``order-desc-xyz``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Name of the field used to order the range list ``xyz``.

``partial``
~~~~~~~~~~~
   Add this attribute when the form does not include
   all the fields of the resource to update.
Widgets
-------
By default, the widget used is ``<solid-form-label-text>``. Cf the
Matthieu Fesselier's avatar
Matthieu Fesselier committed
`Widget <https://docs.startinblox.com/import_documentation/Widgets/Reference.html>`__ page for more info.
Matthieu Fesselier's avatar
Matthieu Fesselier committed
Events
-------

``formChange``
~~~~~~~~~~~~~~
   Triggered when the form values change

``save``
~~~~~~~~~~~~~~
   Triggered when the response of the submit has been received (successfull or not)