@view_config(renderer="templates/form.pt", name="autocomplete_input")
@demonstrate("Autocomplete Input Widget")
def autocomplete_input(self):
choices = ["bar", "baz", "two", "three", "foo & bar", "one < two"]
widget = deform.widget.AutocompleteInputWidget(
values=choices, min_length=1
)
class Schema(colander.Schema):
text = colander.SchemaNode(
colander.String(),
validator=colander.Length(max=100),
widget=widget,
description='Enter some text (Hint: try "b" or "t")',
)
schema = Schema()
form = deform.Form(schema, buttons=("submit",))
return self.render_form(form)