Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
devel:documentation:application_configuration:dev:dynamic-forms [2019/02/01 10:47]
tomiskar
devel:documentation:application_configuration:dev:dynamic-forms [2019/02/14 14:26]
tomiskar
Line 1: Line 1:
 ====== Dynamic forms (eav) ====== ====== Dynamic forms (eav) ======
  
-{{tag> configuration eav form}}+{{tag> configuration eav form attachment}}
  
 Dynamic forms are used for: Dynamic forms are used for:
Line 40: Line 40:
   * ''BYTEARRAY'' - byte[]   * ''BYTEARRAY'' - byte[]
   * ''UUID'' - uuid identifier. Indexed.   * ''UUID'' - uuid identifier. Indexed.
-  * ''ATTACHMENT'' - attachment (~binary file). Read more about [[..:..:modules_rpt:dev:attachment_manager|attachments]].+  * ''ATTACHMENT'' - attachment (~binary file). Read more about [[#attachments|attachments]]. 
 + 
 + 
 +<note info>Changing ''persistentType'' and ''confidential'' is possible only for attributes without persisted values => when attribute is not used for some values. Data migration, when attribute's ''persistentType'' or ''confidential'' is changed is not supported now.</note>
  
 with properties: with properties:
-  * ''code'' - unique code in the one form definition (scope) 
-  * ''name'' - user friendly attribute name 
-  * '' 
   * ''readonly''   * ''readonly''
   * ''multi values'' - Is represented on the front-end by a textarea, where a line is a value (a new line separates the values). This property is supported for persistent types ''CHAR'', ''TEXT'', ''INT'', ''LONG'', ''DOUBLE'' and ''UUID''.   * ''multi values'' - Is represented on the front-end by a textarea, where a line is a value (a new line separates the values). This property is supported for persistent types ''CHAR'', ''TEXT'', ''INT'', ''LONG'', ''DOUBLE'' and ''UUID''.
   * ''confidential'' - .The values are stored in an [[..:..:security:dev:confidential-storage|confidential storage]]). Stored values of these attributes - substitute characters only - are loaded on the front-end. The value can only be changed and determined whether it is filled in. This property is supported for persistent types ''CHAR'', ''TEXT'', ''INT'', ''LONG'', ''DOUBLE'', ''UUID'', ''BYTEARRAY''.   * ''confidential'' - .The values are stored in an [[..:..:security:dev:confidential-storage|confidential storage]]). Stored values of these attributes - substitute characters only - are loaded on the front-end. The value can only be changed and determined whether it is filled in. This property is supported for persistent types ''CHAR'', ''TEXT'', ''INT'', ''LONG'', ''DOUBLE'', ''UUID'', ''BYTEARRAY''.
-  * ''required'' - value validation, read more. +  * ''required'' - value validation, [[#validation|read more]]
-  * ''unique'' - value validation, read more. +  * ''unique'' - value validation, [[#validation|read more]]
-  * ''min'' - value validation, read more. +  * ''min'' - value validation, [[#validation|read more]]
-  * ''max'' - value validation, read more. +  * ''max'' - value validation, [[#validation|read more]]
-  * ''regex'' - value validation, read more. +  * ''regex'' - value validation, [[#validation|read more]]
-  * ''validationMessage'' - custom message, when some validation fails, read more.+  * ''validationMessage'' - custom message, when some validation fails, [[#validation|read more]].
  
 Dynamic form attribute can be rendered differently on frontend. Face type (faceType) property is used for choosing frontend renderer. Default renderer is chosen by persistent type (e.g. UUID → UUID).  Dynamic form attribute can be rendered differently on frontend. Face type (faceType) property is used for choosing frontend renderer. Default renderer is chosen by persistent type (e.g. UUID → UUID). 
Line 114: Line 114:
  
 Read more in [[tutorial:dev:dynamic_form_localization|tutorial]] Read more in [[tutorial:dev:dynamic_form_localization|tutorial]]
 +
 +===== 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.
 +
 +=== 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).
 +
 +<note info>Unique validation is not supported for ''BYTEARRAY'' and ''ATTACHMENT'' persistent types.</note>
 +
 +<note info>
 +Use single back slash for configure regex on GUI => use double back slash in java. 
 +Example regex for the ip v4 address:
 +  * GUI: ''^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$''
 +  * java: ''^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$''
 +</note>
 +
 +{{ :devel:documentation:application_configuration:dev:validation.png |}}
 +
 +==== Validation message ====
 +
 +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>
 +
  
 ===== Code lists ===== ===== Code lists =====
Line 132: Line 175:
  
 <note tip>Only identity extended attribute values support authorization policies. Support for other entities can be added in future.</note> <note tip>Only identity extended attribute values support authorization policies. Support for other entities can be added in future.</note>
 +
 +===== Attachments =====
 +
 +Attachments can be uploaded for the attributes with persistent type ''ATTACHMENT''. Attachment is uploaded immediately after user selects file from his file system - attachment is uploaded as [[..:..:modules_rpt:dev:attachment_manager#temporary_files_and_attachments|temporary]] to server and it's identifier is used as extended attribute value. Extended attribute can be saved then (when whole extended form is submitted).
 +
 +Attachment can be downloaded from frontend. If attachment is picture (~ attachment mime type starts with ''image/*''), then preview of saved extended attribute's attachment is available directly in extended attribute form.
 +Download and preview is supported for agendas (entity types): identity, role, tree node, contract and contract slice => role requests (role lifecycle) and identity roles (parameters for the assigned roles) are  
 +
 +{{:devel:documentation:application_configuration:dev:attachment-preview.png|}}
 +
 +Read more about [[..:..:modules_rpt:dev:attachment_manager|attachments]] usage in the application (e.g. how to increase maximum file size).
 +
 +
 +
 ===== Future development ===== ===== Future development =====
  
-  * API for saving the owner and the eav form in one transaction (=> save ''IdmFormInstance''). 
-  * Attribute properties validation - by supported persistent type (see above). 
   * Form value data migration, when persistent type is changed.   * Form value data migration, when persistent type is changed.
-  * [[https://redmine.czechidm.com/issues/1140|#1140]] Add module into form definition table - now is module resolved dynamically by ownerbut this cannot be overriden by module - e.g. when reg module adds new form for identity, localization is searched by owner in core module => and cannot be found.+  * Attachment renderersupport 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.
  • by tomiskar