Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 48 lines (36 sloc) 2.774 kb
34f54cc @kaos Added documentation stubs.
kaos authored
1
b11a84e @kaos doc: rearranged ref docs to include the meta doc.
kaos authored
2 .. include:: meta-typeselect.rst
3
4
eb74555 @kaos doc: migrated the remaining action documentation.
kaos authored
5 Show possible selections whilst typing.
34f54cc @kaos Added documentation stubs.
kaos authored
6
eb74555 @kaos doc: migrated the remaining action documentation.
kaos authored
7 Performs a search for the typed text whilst typing in an input field. Shows possible matching pages in a selectable list.
8
9 Example::
10
11 <form method="get" action="/search">
12 <input type="text" id="person" name="person" value="" />
13 <ul id="suggestions"></ul>
14 <input type="hidden" id="person_id" value="" />
15 {% wire id="person" type="keyup"
16 action={typeselect cat="person"
17 target="suggestions"
18 action_with_id={with_args action={set_value target="person_id"} arg={value select_id}}
19 action={submit}}
20 %}
21 </form>
22
23 This is a rather complicated example. It connects the typeahead action to the input element. The list of suggestions will be shown in the `<ul/>` with id `suggestions`. Only pages in the category `person` will be found.
24
25 The listed suggestions will have two actions attached. One action will set the value of the hidden input element `person_id` to the id of the selected suggestion (which is a :term:`page`). The other action will submit the form.
26
27 The `action_with_id` arguments are always performed before the `action` arguments.
28
29 The `typeselect` action accepts the following arguments:
30
31 ============== ================================================================ =======
32 Argument Description Example
33 ============== ================================================================ =======
34 target The id of element that will show the list of suggestions. target="mylist"
35 cat The category for the searched pages.
36 This argument can be repeated. cat="text"
37 template Template used to show the list of possible pages.
38 This defaults to the template "_action_typeselect_result.tpl".
39 The template gets the following arguments:
40 result (list of ids), action_with_id and action. template="_show_suggestions.tpl"
41 action_with_id Actions executed when a suggestion is selected.
42 The id of the selected page will be added as the `id` parameter.
43 This argument can be repeated. action_with_id={postback postback="page_select"}
44 action Actions executed when a suggestion is selected.
45 This list is executed after the `action_with_id` actions.
46 This argument can be repeated. action={slide_up target="form-id"}
47 ============== ================================================================ =======
Something went wrong with that request. Please try again.