Skip to content
Snippets Groups Projects
Commit e4dff090 authored by Matthieu Fesselier's avatar Matthieu Fesselier
Browse files

update: add validationMixin

parent 561ebbf0
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ Mixins ...@@ -16,6 +16,7 @@ Mixins
This component uses the following mixin: This component uses the following mixin:
* :ref:`next-mixin <next-mixin>` * :ref:`next-mixin <next-mixin>`
* :ref:`validation-mixin <validation-mixin>`
Please check their documentation to know more about its capabilities. Please check their documentation to know more about its capabilities.
...@@ -33,7 +34,10 @@ Attributes ...@@ -33,7 +34,10 @@ Attributes
``confirmation-message`` ``confirmation-message``
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
Add this attribute to create a dialog box linked with the submit button of the solid-form. *Available from version 0.13*
**Migrated to the validation mixin page in version 0.16**
Add this attribute to create a dialog box linked with the button of the solid-delete.
Its value matches the message displayed in the dialog box. Its value matches the message displayed in the dialog box.
......
...@@ -17,6 +17,7 @@ Mixins ...@@ -17,6 +17,7 @@ Mixins
This component uses the following mixins: This component uses the following mixins:
* :ref:`next-mixin <next-mixin>` * :ref:`next-mixin <next-mixin>`
* :ref:`store-mixin <store-mixin>` * :ref:`store-mixin <store-mixin>`
* :ref:`validation-mixin <validation-mixin>`
* :ref:`widget-mixin <widget-mixin>` * :ref:`widget-mixin <widget-mixin>`
Please check their documentation to know more about their capabilities. Please check their documentation to know more about their capabilities.
...@@ -29,7 +30,7 @@ Attributes ...@@ -29,7 +30,7 @@ Attributes
List of the fields used to create the form (by default, all of them are used). List of the fields used to create the form (by default, all of them are used).
``label-[field]`` ``label-[field]``
~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
When displaying a form, the default labels are the fields names of the model. When displaying a form, the default labels are the fields names of the model.
If you want something fancier, you can set this attribute. If you want something fancier, you can set this attribute.
i.e. ``label-username="Your name"`` i.e. ``label-username="Your name"``
...@@ -41,7 +42,7 @@ Attributes ...@@ -41,7 +42,7 @@ Attributes
display their own submit button. display their own submit button.
``upload-url-[field]`` ``upload-url-[field]``
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
URL to upload file for field ``[field]``, it URL to upload file for field ``[field]``, it
automatically set ``widget-[field]`` to ``solid-form-file`` if net defined. automatically set ``widget-[field]`` to ``solid-form-file`` if net defined.
It’s particularly useful with a dropdown field. It’s particularly useful with a dropdown field.
...@@ -51,13 +52,13 @@ Attributes ...@@ -51,13 +52,13 @@ Attributes
Text of the submit button of the form. Text of the submit button of the form.
``range-[field]`` ``range-[field]``
~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
URL of a container which list the accepted values URL of a container which list the accepted values
for the field ``[field]``. It’s particularly useful with a dropdown for the field ``[field]``. It’s particularly useful with a dropdown
field. field.
``enum-[field]`` ``enum-[field]``
~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
*Available from version 0.13* *Available from version 0.13*
List of values of your choice for the field ``[field]``. List of values of your choice for the field ``[field]``.
...@@ -72,7 +73,7 @@ Attributes ...@@ -72,7 +73,7 @@ Attributes
and "a", "b", "c" will be loaded in value attribute. and "a", "b", "c" will be loaded in value attribute.
``order-asc-[field]`` or ``order-desc-[field]`` ``order-asc-[field]`` or ``order-desc-[field]``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Name of the field used to order the range list ``[field]``. Name of the field used to order the range list ``[field]``.
``partial`` ``partial``
...@@ -86,12 +87,12 @@ Attributes ...@@ -86,12 +87,12 @@ Attributes
``min-[field]`` ``min-[field]``
~~~~~~~~~~~ ~~~~~~~~~~~~~~~
Add this attribute for the field ``[field]`` to define its minimum value. Add this attribute for the field ``[field]`` to define its minimum value.
It works only with a ``solid-form-number`` widget. It works only with a ``solid-form-number`` widget.
``max-[field]`` ``max-[field]``
~~~~~~~~~~~ ~~~~~~~~~~~~~~~
Add this attribute for the field ``[field]`` to define its maximum value. Add this attribute for the field ``[field]`` to define its maximum value.
It works only with a ``solid-form-number`` widget. It works only with a ``solid-form-number`` widget.
...@@ -103,15 +104,16 @@ Attributes ...@@ -103,15 +104,16 @@ Attributes
It works only with a ``solid-form-text`` widget. It works only with a ``solid-form-text`` widget.
``title-[field]`` ``title-[field]``
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
*Available from version 0.13* *Available from version 0.13*
Add this attribute for the field ``[field]`` to precise extra information about an element. Add this attribute for the field ``[field]`` to precise extra information about an element.
It works only with a ``solid-form-text`` widget. It works only with a ``solid-form-text`` widget.
``confirmation-message`` ``confirmation-message``
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
*Available from version 0.13* *Available from version 0.13*
**Migrated to the validation mixin page in version 0.16**
Add this attribute to create a dialog box linked with the submit button of the solid-form. Add this attribute to create a dialog box linked with the submit button of the solid-form.
Its value matches the message displayed in the dialog box. Its value matches the message displayed in the dialog box.
......
.. _validation-mixin:
validation-mixin
================
*Available from version 0.16*
The validation mixin creates a modal dialog before deleting or submitting data.
Used by:
--------
* :ref:`solid-delete <solid-delete>`
* :ref:`solid-form <solid-form>`
Attributes
----------
``confirmation-type``
~~~~~~~~~~~~~~~~~~~~~
It is a prerequisite and can take two options :
- ``confirm``: to access to a basic modal dialog.
- ``dialog``: to get a ``<dialog>`` more customizable.
``confirmation-message``
~~~~~~~~~~~~~~~~~~~~~~~~
Message displayed in the modal dialog (``confirm`` or ``dialog`` type).
The message by default is "Please, confirm your choice".
**The attributes below only concern ``dialog`` type.**
``confirmation-submit-text``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Text displayed on the submit button ("Ok" by default).
``confirmation-cancel-text``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Text displayed on the cancel button ("Cancel" by default).
``confirmation-submit-class``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Submit button class name (undefined by default).
``confirmation-cancel-class``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cancel button class name (undefined by default).
Some examples of the use of validation mixin attributes :
.. code:: html
<solid-delete
data-src="http://server/user/"
confirmation-type="confirm"
confirmation-message="Thank you to confirm the data deletion."
></solid-delete>
<solid-form
data-src="../data/list/events.jsonld"
confirmation-type="dialog"
confirmation-message="Are you sure you want to create this event ?"
confirmation-submit-text="Yes, I am"
confirmation-submit-class="submit-button"
confirmation-cancel-class="cancel-button"
></solid-form>
\ No newline at end of file
...@@ -30,10 +30,29 @@ List of attributes (core framework) ...@@ -30,10 +30,29 @@ List of attributes (core framework)
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
* :ref:`solid-map <solid-map>` * :ref:`solid-map <solid-map>`
``confirmation-cancel-text``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* :ref:`validation-mixin <validation-mixin>`
``confirmation-cancel-class``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* :ref:`validation-mixin <validation-mixin>`
``confirmation-message`` ``confirmation-message``
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
* :ref:`solid-form <solid-form>` * :ref:`validation-mixin <validation-mixin>`
* :ref:`solid-delete <solid-delete>`
``confirmation-type``
~~~~~~~~~~~~~~~~~~~~~
* :ref:`validation-mixin <validation-mixin>`
``confirmation-submit-class``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* :ref:`validation-mixin <validation-mixin>`
``confirmation-submit-text``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* :ref:`validation-mixin <validation-mixin>`
``counter-template`` ``counter-template``
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment