Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • A api
  • Project information
    • Project information
    • Activity
    • Members
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
Collapse sidebar
  • ironapi
  • api
  • Wiki
  • Api
  • Form Input Types

Last edited by Andrea Pavlovic Dec 03, 2021
Page history

Form Input Types

Form input types

Basically we can map the attributes of an entity to a set of possible input widgets. For example an integer (or any kind of numeric values) can be displayed as text input filed, sliders, input filed with arrows on the right end to modify the value. Or in the case of a boolean attribute possible widgets would be a select box with true and false as values, a check box or two radio buttons etc.

We have to come up with at least one widget per attribute type. I decided to organize the data types as a tree. The first level of the tree consists of database data types. Now we can introduce all possible widgets as children of the nodes from the first level. A first level data type might be "text" but we can define subnodes of "text" like "multilineText" or "email" in order to be more specific.

All data types may be fetched via API

POST /data/constant/data_type/query

Below you can find the actual list of the type hierarchy:

parent_name name
NULL root
root numeric
numeric percentage
root integer
root numeric[]
root double precision[]
root interval
root bytea
root jsonb
root bool
root date
root time
root timestamp
root timestamptz
root integer[]
root oid
root matrix
root vector
root scalar
root bigint
root bigint[]
root json
root text
text fspath
text email
text html
text color
text password
text multiline
text url
bool boolean
file video
jsonb file
file picture

Now a form can be defined as a set of widgets to display the all attributes of the entity. The universe contains the definition of each entity and all it's attributes. Let's keep to the example product_category of the entity product.

{
	"id": 963,
	"name": "product_category",
	"label": "Product category",
	"description": "The category of the product.",
	"dataType": "bigint",
	"required": true,
	"displayOrder": 0,
	"isSystemAttribute": false,
	"isReference": true,
	"referenceDetails": {
		"targetModule": "store",
		"targetEntity": "product_category",
		"targetAttribute": "id",
		"resolveUrl": "/store/product_category/{{product_category}}",
		"resolveVerb": "GET"
	}
}

Now we are able to render the input filed with the label "Product category" using a default bigint widget (which might be a simple input text field with a validator). Additionally we now that the field is "required", so we can check this in advance before submitting it to the backend. And actually we know that this field is a reference to the entity product category.

Clone repository
  • API
    • Available Endpoints
    • Changing Passwords
    • Form Input Types
    • Introduction
    • Logout
    • Plugins
    • Queries
    • Queries
      • Attributes
      • Context
      • Query Examples
      • Query Search Options
      • Referenced Instances
      • Saved Queries
    • Schema_Changes
    • Storing Files
View All Pages