Resident Portal UI Specifications
Overview
UI specs of resident module are used to configure the form fields across Resident Portal. UI specs are saved as a JSON file with a list of fields. Each field has a set of attributes/ properties that can be configured which affects the look and feel along with the functionality of the field.
Below is the list of all the properties available for each field in the Resident Portal UI specs:
Property Name
Details
Sample Value
id
The id property is the unique id provided to a field to uniquely identify it. The id can be alpha-numeric without any spaces between them.
"id":"zone"
description
This is a non-mandatory property used to describe the field.
"description": "zone"
labelName
This property defines label name for the field. This property has sub-attributes as the language code (eng, fra, ara) to store data in different languages based on the country's configuration.
"labelName": { <br>"eng": "Zone", <br>"ara": "منطقة", <br>"fra": "Zone"}
controlType
This property defines the kind of UI component to be used to capture data in UI. Currently the values that can be used are: <br/> • textbox (creates multiple textboxes for each field to capture input in all the languages configured for the setup)<br/>• dropdown <br/>• fileupload <br/> • date (creates a date picker)<br/> • ageDate (creates a date picker along with number toggle to provide age directly)<br/> • checkbox (creates a toggle checkbox for the field which can be checked or unchecked)<br/> • button (creates dropdown options as buttons, which user can select easily)
inputRequired
This property decides if the field is to be displayed in the UI form or not. It is useful for some internal fields which do not need any input from the user.
required
This is a mandatory property which decides if the field is a required form field or not. If true, user must provide some value for the field.
type
This property defines the data type of the value corresponding to this field. The data types supported are “number”, “string” and “simpleType”.<br/> The type “simpleType” means that language specific value will be saved along with the language code.
fieldType
This property is relevant when control type is “dropdown” or “button”. It defines if the field is of type “default” or “dynamic”. <br/>If it is “dynamic” then all the options for the dropdown are populated from the “master.dynamic_field” table otherwise they are populated from corresponding table example “master.gender”
subType
This is relevant for 2 cases:<br/>1. When control type is “dropdown”/ “button” and the type is “dynamic” then “subtype” can be used to populate the options for the field with the data available in “master.dynamic_field” table.<br/>2. When the control type is “fileupload”, then the property ”subtype” is used to map the field to a “code” in the “master.doc_category” table.
validators
This property enables us to add the list of language specific validators for the field. <br/>* Each validator can have the below fields,<br/>“langCode”,<br/>“type”,<br/>“validator”,<br/>“arguments”,<br/>“errorMessageCode”<br/><br/>* The “type” defines the validation engine type.<br/>* The “validator” gives the pattern/ methodName/ scriptName/ expression<br/>* The “arguments” array to is used to hold parameter or dependent field ids required for validation<br/>* The “errorMessageCode” can be given to add custom error message which will be shown to the user when the validation fails. The error message corresponding to this code will be picked from language specific i18n translation files. In case “errorMessageCode” is not given then generic error message will be displayed to the user when validation fails. <br/><br/>Currently, regex is supported by MOSIP.<br/>If “langCode” is not added then same “validator” is used for all languages of the field.
<br>"validators": [{ <br>"langCode": "eng", <br>"type": "regex", <br>"validator": "^(?=.{0,50}$).*", <br>"arguments": [], <br>"errorMessageCode": "UI_1000"<br>},{ <br>"langCode": "ara", <br>"type": "regex", <br>"validator": "^[A-Z]+$", <br>"arguments": []<br>},{ <br>"langCode": "fra", <br>"type": "regex",<br>"validator": "^[A-Z]+$", <br>"arguments": []<br>}]
locationHierarchyLevel
This attribute is mandatory for the location dropdown fields. <br/>The value will be as per corresponding location hierarchy level from the master.loc_hierarchy_list table.
{<br>"id":"region",<br>"controlType":"dropdown",<br>"fieldType":"default",<br>"type":"simpleType",<br>"parentLocCode":"MOR",<br>"locationHierarchyLevel":1<br>..}
parentLocCode
This attribute is to be used only for location dropdown fields and it is optional. <br/>The corresponding location dropdown will be pre populated in UI based on the value in “parentLocCode”. <br/>If this attribute is NOT mentioned in UI specs, then the dropdown will be populated based on selection in its parent dropdown, as before. <br/>For the first dropdown, in case this attribute is not mentioned in UI specs then the value from “mosip.country.code” configuration will be used for backward compatibility.
{<br>"id":"region",<br>"controlType":"dropdown",<br>"fieldType":"default",<br>"type":"simpleType",<br>"parentLocCode":"MOR",<br>"locationHierarchyLevel":1<br>..}
alignmentGroup
* This property is used to group the fields on the screen. <br>* If it is skipped, then all the fields will appear in same sequence (horizontally layout) as they appear in UI specs. <br>* If you want the first and fifth field to be in same row in the screen, you can add this attribute with same group name. <br>* The UI is responsive so it will accommodate as many fields in one row as they will fit comfortably.
containerStyle
This is used to optionally apply some CSS styles to the UI field container.
"containerStyle": {<br>"width": "600px",<br>"margin-right": "10px"<br>}
Last updated