A form resource allows the programmer to insert a form in an application.
A form is a complex structure. A form often need to be filled in advance with data coming from the database.
Then it send POST data through a POST request and after that some logic is executed in order to update the
system.
GET section
Request
Sometimes we need to pass some parameter to a query that feels the form.
Example: parentId = 2302
If you want to know about the Validation check out the related page.
Query
Oftentimes we need to pre-feel the form with some data that comes from the database in order to allow the user to edit that data.
In order to do that we need to write a query.
We can write the query in plain SQL and eventually connect the paratameters needed to get paramenters.
As you can see the SQL parameter is inserted in the query using a placeholder: :parametername
The SQL parameter is connected to the GET parameter using: “getparameter”: “parentid”
We can insert as many paremeters as we need.
It is possible to send to the query a session parameter using: “sessionparameter”: “sessionparametername”
It is possible to send to the query a constant parameter using: “constantparameter”: “constantvalue”
If you want to know more about SQL paramenters check out the Query page.
Form
The properties of the field object are:
label: the descriptive text associated to the field the user can read
type: the type of the field [textfield, numeric, textarea, currency, date, dropdown, sqldropdown, hidden, submitbutton]
name: html name attrbute associated to the field
placeholder: html placeholder attrbute associated to the field
sqlfield: used in case we need to load data in a field that comes from a query
sessionparameter: used in case we need to load data in a field that comes from a session parameter
getparameter: used in case we need to load data in a field that comes from a getparameter parameter
postparameter: used in case we need to load data in a field that comes from a postparameter parameter
constantparameter: used in case we need to load data in a field that comes from a constantparameter parameter
width: the width of the field in bootstrap terms
row: the row number where the field is located in bootstrap terms
options: used in case of dropdown field a list of possible option objects Ex: { “value”: “0”, “label”:”(Not set)” }
query: used by sqldropdown
valuesqlfield: used by sqldropdown
labelsqlfield: used by sqldropdown
POST section
Request
What a form usually does is to pass POST parameters using a POST request and then to process that parameters
We need to give a description of the post parameters and of the validation we need to apply to them.
If you want to know more about the Validation check out the related page.
Transactions
The trasactions list contains a set of query objects that change the status of the database.
A commit is set in order to make all changes permanent only if all queries succeed.
As you can see the SQL parameter is inserted in the query using a placeholder: :parametername
The SQL parameter is connected to the GET parameter using: “postparameter”: “parentid”
We can insert as many paremeters as we need.
It is possible to send to the query a session parameter using: “sessionparameter”: “sessionparametername”
It is possible to send to the query a constant parameter using: “constantparameter”: “constantvalue”