Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
924b682b
Commit
924b682b
authored
May 09, 2016
by
Rafael Ostertag
Browse files
Work in progress commit of API.md.
parent
cf61161b
Changes
1
Hide whitespace changes
Inline
Side-by-side
API.md
View file @
924b682b
<!-- -*- markdown -*- -->
API: Client / Server
====================
...
...
@@ -19,74 +21,99 @@ data-required: 'yes'|'no' - yes: The element is required. The form can't be su
Asynchronous request (read AJAX) initiated by the client receive a JSON Response from the server containing at least:
{
"status": "success"|"error",
"message": "<message>"
{
"status": "success"|"error",
"message": "<message>"
}
`status`
indicates whether or not the request has been fullfiled by the server (
`"success"`
) or encountered an error (
`"error"`
).
On
`"error"`
the client must display
`"<message>"`
to the user. On
`"success"`
, the client may display
`"<message>"`
to the user.
On
`"error"`
the client must display
`"<message>"`
to the user. On
`"success"`
, the client may display
`"<message>"`
to the user.
Depending on the request, the server may provide additional
information in the response, as outlined below.
### Form Group Configuration
As part of the server response, the JSON stream may contain a key
`form-update`
. It contains an array of objects having following
`form-update`
. It contains an array of objects having
the
following
structure
{
...
"form-update" : [
{
"form-element": "<element_name>",
"hidden": true | false,
"disabled": true | false,
"required": true | false,
"value": <value>
},
...
],
...
...
"form-update" : [
{
"form-element": "<element_name>",
"hidden": true | false,
"disabled": true | false,
"required": true | false,
"value": <value>
},
...
],
...
}
`"form-element"`
: the name of the HTML Form Element as it appears in the
`name`
attribute.
: the name of the HTML Form Element as it appears in the
`name`
attribute.
`"hidden"`
: whether the Form Group is visible (value:
`false`
) or
invisible (value:
`true`
).
: whether the Form Group is visible (value:
`false`
) or invisible (value:
`true`
).
`"disabled"`
: whether or not the Form Element is disabled HTML-wise.
`"required"`
: whether or not the Form Element receives the HTML5
`required`
attribute.
: whether or not the Form Element receives the HTML5
`required`
attribute.
`"value"`
: For textual HTML Form Input elements, it is supposed to be a
scalar value, which is set on the element.
: For textual HTML Form Input elements, it is supposed to be a scalar value, which is set on the element.
When
`"form-element"`
references a
`<select>`
element, a scalar value
selects the corresponding value from the option list. In order to replace
the option list, use an array of objects, having this format
the
entire
option list, use an array of objects, having this format
[
{
"value": 100,
"text": "a",
"selected": true
},
{
"value": 200,
"text": "b",
"selected": false
}
{
"value": 100,
"text": "a",
"selected": true
},
{
"value": 200,
"text": "b",
"selected": false
}
]
`"select"`
is optional, as is
`"text"`
. If
`"text"`
is omitted, it
will be derived from value.
HTML checkboxes are ticked with a
`"value"`
of
`true`
. They are
unchecked with
`false`
.
HTML radio buttons are activated by providing the value of the
radio button
`value`
-attribute to be activated in
`"value"`
.
### Redirection
Depending on the request, the server may return redirection
information to client. It is up to the client to respect the
redirection information. The format of redirect information is
outlined below
{
...
"redirect": "no" | "url" | "client"
"redirect-url": "<url>"
...
}
`"redirect"`
Form load (update)
...
...
@@ -285,3 +312,6 @@ HTML Form Element
Form Group
: The sourrounding
`<div>`
containing the
`.control-label`
,
`.form-control`
`<div>`
s, and
`.help-block`
`<p>`
.
Client
:
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment