X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=templates%2Fwebpages%2Fgeneric%2Fautocomplete.html;h=5bd35c0b23ab56c6e1aa0270bf88b9838d0b4606;hb=061f4d6d32ed95055114582ede45e8387b302a53;hp=6b9681f14e9e777f79ccb40940de1a889c7cff66;hpb=6be015fafb81c9553f44b8e06ec3812ba6befe9e;p=kivitendo-erp.git diff --git a/templates/webpages/generic/autocomplete.html b/templates/webpages/generic/autocomplete.html index 6b9681f14..5bd35c0b2 100644 --- a/templates/webpages/generic/autocomplete.html +++ b/templates/webpages/generic/autocomplete.html @@ -4,7 +4,7 @@ This template enables auto completion for input fields. Calling Syntax is: - INCLUDE 'generic/autocomlete', [ + INCLUDE 'generic/autocomplete', [ { SPEC_1 }, { SPEC_2 }, ... @@ -14,13 +14,15 @@ 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 + selector : a jquery selector, specifying the input fields column : specifies the column that is represented by the bound field. typically description or name. + params : additional params that should be included in the request, like customer/vendor information. expects a hash. TODO FIELDS: - addition fields like type, vc etc. - additional dependencies, see jquery.autocomplete documentation - hook function on select, again see jquery documentation + - limit: maximum number of results shown. a simple SPEC would look like this: @@ -43,10 +45,14 @@ [%- DEFAULT token.script = script %] [%- DEFAULT token.action = 'ajax_autocomplete' %] [%- DEFAULT token.INPUT_ENCODING = 'utf8' %] +[%- FOREACH key = token.params.keys %] +[%- token.additional_url = token.additional_url _ '&' _ key _ '=' _ token.params.$key %] +[%- END %] [%- token.url = token.script _ '?action=' _ token.action _ '&INPUT_ENCODING=' _ token.INPUT_ENCODING %] [%- SET token.url = token.url _ '&column=' _ token.column IF token.column %] +[%- SET token.url = token.url _ token.additional_url IF token.additional_url %] $(document).ready( $('[% token.selector %]').autocomplete('[% token.url %]')); [%- END %]