How to make an interactive search box?

41 views
Skip to first unread message

Saiph Kappa

unread,
Oct 15, 2017, 12:56:43 PM10/15/17
to Play Framework
Hello,

I am using the following template as a search box.

@helper.input(userForm("foo"), '_label->null) { (id, name, value, args) =>
<input type="search" name="@name" id="@id" @toHtmlArgs(args)>
}

How can I make it interactive so that every time I type a key it goes to a database for searching that prefix?

Thanks,
Saiph.

Patrick Li

unread,
Oct 19, 2017, 12:10:37 AM10/19/17
to Play Framework
This you should be using javascript, such as Twitter Typeahead https://twitter.github.io/typeahead.js/

Adam Lane

unread,
Oct 19, 2017, 12:20:07 AM10/19/17
to Play Framework
+1 for leveraging existing solutions.  If you do opt for the typeahead route, here is a maintained fork: https://github.com/corejavascript/typeahead.js
Reply all
Reply to author
Forward
0 new messages