autocomplete
Description
A wpart responsible for autocompletion input form. It requires java script enabled and additional java script library (attached to the Erlang Web release).
During the system start, the required libraries (JQuery) indicator image and CSS files are copied into the docroot directory. Of course, the stylesheet is provided only for example and there is no reason for forbidding the changes that could be made on it. The proper dispatcher entries are also created. Nevertheless, it is a user duty to link to those resources in his template header. It could be done simply by adding the following lines to the head section of the template where wpart_autocomplete is going to be used:
<link rel="stylesheet" href="/autocomplete.css" type="text/css" /> <script src="/jquery.js" type="text/javascript"> </script> <script src="/jquery.autocomplete.js" type="text/javascript"> </script>
Remember: since Xmerl collapses tags that have no body it is mandatory to put a space (' ') between script tags!
The rendered widget is <input type="text" ... />.
Validation
option |
format |
description |
error message |
The same as in string |
|||
HTML meta-attributes
name |
format |
description |
complete |
"Val1 | Val2 | Val3 | ..." |
Specifies the set of the options that will be displayed as a helpers. Elements are separated with a | (pipe) character. |
Examples
Records definitions
Parameters are the same as in string basic type (since it is a string actually, but tuned one - with one additional complete).
...
{autocomplete, [{complete, ["String1", "String2", "Last autocompletion"]},
{min_length, 6},
{max_length, 128},
{regexp, "^[a-zA-Z][a-zA-Z]*$"},
%% other parameters
]
},
...
HTML tag
<wpart:autocomplete complete="String1 | String2 | Last autocompletion" OTHER_HTML_ATTRIBUTES />
