X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/fdfd7f203f3ff64a86e232a8fe30b865d5a8d9bb..6be015fafb81c9553f44b8e06ec3812ba6befe9e:/templates/webpages/generic/autocomplete.html diff --git a/templates/webpages/generic/autocomplete.html b/templates/webpages/generic/autocomplete.html new file mode 100644 index 000000000..6b9681f14 --- /dev/null +++ b/templates/webpages/generic/autocomplete.html @@ -0,0 +1,52 @@ +[%#- + Autocompletion + + This template enables auto completion for input fields. + Calling Syntax is: + + INCLUDE 'generic/autocomlete', [ + { SPEC_1 }, + { SPEC_2 }, + ... + ] + + where SPEC is a hash containing the following keys: + + script : the script that is called for autocompletion, defaults to the invoking script + action : action in the ajax script, defaults to 'ajax_autocomplete' + selector : a jquery selector, specifying the input field + column : specifies the column that is represented by the bound field. typically description or name. + + TODO FIELDS: + - addition fields like type, vc etc. + - additional dependencies, see jquery.autocomplete documentation + - hook function on select, again see jquery documentation + + a simple SPEC would look like this: + + { selector => '#description', column => 'description' } + # field with id="description" should be autocompleted with descriptions + + { script => 'ic.pl', selector => '[name^="partnumber_"]', column => 'partnumber' } + # let ic.pl autocomplete by partnumbers, bind this to all fields where the name begins with "partnumber_" + + + + The Backend Side + + The called function will recieve the queried string as hashkey "q" in form, as well as every other param specified here. + It should generate a generic ajax header (see form), followed by newline separated list of possible completion values. + +%] +