Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
devel:documentation:application_configuration:dev:dynamic-forms [2019/02/14 15:48] kotisovam part moved to admin guide and edited |
devel:documentation:application_configuration:dev:dynamic-forms [2021/02/10 18:20] (current) tomiskar [Dynamic forms (eav)] |
| |
<note> | <note> |
**''FormService'' service for working with the extended attributes on the back-end.** **''FormInstance''** utility is useful on BE - contains value transformation to maps by attributes etc.. | **''FormService'' service for working with the extended attributes on the back-end.** **''FormInstance''** utility is useful on BE - contains value transformation to maps by attributes etc.. Use this service in your custom module, benefits: |
| * single autowired service for work with definitions, attributes and values |
| * cache ''core:form-definition-cache'' for loading form definitions (with attributes) is effective here. |
</note> | </note> |
<note> | <note> |
| |
<note important>Saving form values for the form definition work as **PATCH**. When attribute value has to be deleted, then form value with **null** has to be given (use it even for multi valued attributes).</note> | <note important>Saving form values for the form definition work as **PATCH**. When attribute value has to be deleted, then form value with **null** has to be given (use it even for multi valued attributes).</note> |
| |
| <note>If single attribute is saved (''FormService#saveAttribute''), then event ''EAV\_SAVE'' is not published. Save all attributes (''FormService#saveValues''), if publishing event ''EAV_SAVE'' for owner is needed.</note> |
| |
Dynamic form attribute supports data types (''persistentType''): | Dynamic form attribute supports data types (''persistentType''): |
* ''CHAR'' - one character | * ''CHAR'' - one character |
* ''TEXT'' - strings (long text). Not indexed - ''SHORTTEXT'' usage is preferred. | * ''TEXT'' - strings (long text). Searching by ''TEXT'' is not supported, column is not indexed - **''SHORTTEXT'' usage is preferred (+ indexed)**. |
* ''SHORTTEXT'' - strings (2000 chars). Indexed. | * ''SHORTTEXT'' - strings (2000 chars). Indexed. |
* ''INT'' - integer | * ''INT'' - integer |
* ''UUID'' - uuid identifier. Indexed. | * ''UUID'' - uuid identifier. Indexed. |
* ''ATTACHMENT'' - attachment (~binary file). Read more about [[#attachments|attachments]]. | * ''ATTACHMENT'' - attachment (~binary file). Read more about [[#attachments|attachments]]. |
| * ''CODELIST'' - referenced code list - persists items "code" into short text. Uses face type as code list code. |
| * ''ENUMERATION'' referenced frontend enumeration - persists items "code" into short text. Uses face type as enumeration name. |
| |
| |
| |
All [[https://github.com/bcvsolutions/CzechIdMng/tree/develop/Realization/frontend/czechidm-core#component-descriptor|component descriptor]] features are supported. Read tutorial, [[tutorial:dev:how_to_create_eav_face_type|how to create custom form attribute renderer]]. | All [[https://github.com/bcvsolutions/CzechIdMng/tree/develop/Realization/frontend/czechidm-core#component-descriptor|component descriptor]] features are supported. Read tutorial, [[tutorial:dev:how_to_create_eav_face_type|how to create custom form attribute renderer]]. |
| |
| Custom configuration can be added to registered renderers (@since CzechIdM 10.8.0) - use ''AbstractFormAttributeRenderer'' on backend to define additional renderer properties. |
| |
===== Adding the support of extended attributes for a new entity ===== | ===== Adding the support of extended attributes for a new entity ===== |
{{tag>validation}} | {{tag>validation}} |
| |
| For form attribute values is possible to configure prepared validations. Validation are evaluated (**on the backend**), when form with extended attributes is saved and sent to backend. Simple validations as ''required'', ''min'', ''max'' are evaluated on frontend after value is changed. |
| |
==== Regex ==== | <note important>Validations are suported for single attribute values only for now (feature request [[https://redmine.czechidm.com/issues/1874|#1874]]).</note> |
| |
| === Required === |
| |
| Value is required. |
| |
| === Unique === |
| |
| Value has to be unique. |
| |
| <note info>Unique validation is not supported for ''BYTEARRAY'' and ''ATTACHMENT'' persistent types.</note> |
| |
| === Min, Max === |
| |
| Value has to be greater than (lesser than) or equal given ''min'' (''max'') values. Real number (38,4) can be configured. |
| |
| <note info>Min and max validation is supported for numeric ''DOUBLE'', ''INT'', ''LONG'' persistent types.</note> |
| |
| === Regex === |
| |
Value has to match given regular expression ([[https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html|java pattern]] is used). | Value has to match given regular expression ([[https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html|java pattern]] is used). |
</note> | </note> |
| |
| {{ :devel:documentation:application_configuration:dev:validation.png |}} |
| |
==== Validation message ==== | === Validation message === |
| |
Custom validation message. If message is not defined, then default message by invalid validation type will be shown. | Custom validation message. If message is not defined, then default message by invalid validation type will be shown. |
| |
<note tip>Can contain localization key (e.g. ''core:validationError.invalid.unique''). Parameters ''min'', ''max'', ''regex'', ''unique'', ''required'' is available for localization message.</note> | <note tip>Can contain localization key (e.g. ''core:validationError.invalid.unique''). Parameters ''min'', ''max'', ''regex'', ''unique'', ''required'' is available for localization message.</note> |
| |
| |
| |
* Attachment renderer: support multiple files, validation support (now is validation on input) | * Attachment renderer: support multiple files, validation support (now is validation on input) |
* Created deep copy, when form values are copied => attachment is linked to two form values and is removed, when the first one is deleted. | * Created deep copy, when form values are copied => attachment is linked to two form values and is removed, when the first one is deleted. |
| * [[https://redmine.czechidm.com/issues/1874|#1874]]: Support unique validation for multivalued eav attributes |