From 591d2e7c43e5e630f16c7776897b75e50d68f1fb Mon Sep 17 00:00:00 2001 From: Rafael Ostertag <rafael.ostertag@math.uzh.ch> Date: Wed, 1 Mar 2017 15:13:14 +0100 Subject: [PATCH] Updated PROTOCOL.md --- doc/PROTOCOL.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/doc/PROTOCOL.md b/doc/PROTOCOL.md index 9af56bfb6..22cc5649e 100644 --- a/doc/PROTOCOL.md +++ b/doc/PROTOCOL.md @@ -133,6 +133,51 @@ having the following structure radio button `value`-attribute to be activated in `"value"`. +### Form Group Configuration Response + +As part of the server response, the JSON stream may contain a key +`element-update`. This key stores information on how to modify HTML elements identified by `id`. Modifying in this +context refers to: + + * Setting attribute values + * Deleting attributes + * Setting content of a HTML element. + +The content of `element-update` is outlined below + + { + ... + "element-update" : { + "<element_id1>": { + "attr": { + "<attr_name1>": "<value1>" | null, + ... + "<attr_nameN>": "<valueN>" | null + }, + "content": "<element_content>" + }, + ... + "<element_idN>": { + "attr": { + "<attr_name1>": "<value1>" | null, + ... + "<attr_nameN>": "<valueN>" | null + }, + "content": "<element_content>" + } + }, + ... + } + +The presence of `element-update` is optional. `<element_idN>` refers to the element's `id`-attribute value. It used +to uniquely identify the HTML element in the DOM. The properties `"attr"` and `"content"` are both optional. + +Supplying `null` as value for `"<attr_nameN>"` will remove the attribute from the HTLM element identified by +`"<element_idN>"`. + +If the element has no `"<attr_nameN>"` attribute, it will be created. In any case, the attribute's value will be set +to the value specified by `"<valueN>"`. See above for handling of `null` value. + ### Redirection Response Depending on the request, the server may return redirection -- GitLab