From b0e57139fd719861f806202e68c635d48ca1d363 Mon Sep 17 00:00:00 2001
From: Carsten  Rose <carsten.rose@math.uzh.ch>
Date: Wed, 15 Mar 2017 14:40:50 +0100
Subject: [PATCH] HTML.md, PROTOCOL.md: added description for 'Typeahead'

---
 doc/HTML.md     | 28 ++++++++++++++++++++++++++++
 doc/PROTOCOL.md | 30 ++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/doc/HTML.md b/doc/HTML.md
index d7d3266f0..2fd09e255 100644
--- a/doc/HTML.md
+++ b/doc/HTML.md
@@ -37,3 +37,31 @@ call to `api/load.php` upon change.
 ### id="close-button"
 ### id="delete-button"
 ### id="form-new-button"
+
+## Typeahead
+
+Typeahead capable text input elements will be defined by the following attributes:
+ 
+### .class='qfq-typeahead'
+
+### .data-typeahead-sip
+
+The SIP will store: 
+
+Use with SQL: `typeAheadSql`
+
+Use with LDAP:
+* `typeAheadLdapServer`
+* `typeAheadLdapBaseDn`
+* `typeAheadLdapSearch`
+* `typeAheadLdapValuePrintf`
+* `typeAheadLdapKeyPrintf`
+ 
+### .data-typeahead-limit
+
+* Defines the limit of entries shown on the client. Default on client is 5. The server will always send a value. The server default is 20.
+
+### .data-typeahead-minlength
+
+* Defines the string minlegth, typed by the user, before the first lookup is started. Default is 2.
+ 
diff --git a/doc/PROTOCOL.md b/doc/PROTOCOL.md
index 2cd25c77d..2f788733a 100644
--- a/doc/PROTOCOL.md
+++ b/doc/PROTOCOL.md
@@ -207,6 +207,20 @@ The format of redirect information is outlined below
 :	Used to provide an URL when `"redirect"` is set to `"url"`. It
 	should be disregarded unless `"redirect"` is set to `"url"`.
 
+### Typeahead dict Response
+
+    {
+		...
+		[
+			{
+				"key": "<key value>",
+				"value": <display value>
+			},
+			...
+		],
+		...
+    }
+
 
 ## API Endpoints
 
@@ -321,6 +335,22 @@ Server Response
 :	The response contains a [Minimal Response].
 	[Redirection Response] may be included.
 
+### Typeahead
+
+The Client initiates Typeahead actions via a GET request. A JSON key/value dict will we be send back as response.
+The Client GET request contains a 'sip' and the already typed value as 'query' paramter.    
+
+Request URL
+:	api/typeahead.php
+
+Request Method
+:	GET
+
+URL Parameters
+:	`sip`, `query`
+
+Server Response
+:   The response contains at least a [Minimal Response]. In addition, a [Typeahead dict],
 
 ## Glossary
 
-- 
GitLab