I\'d like to have a Listbox or similar, where the user could start typing, and the Listbox would narrow down the choices depending on what has already been typed, and autocomple
[Edit] HtmlService is faster and more advanced. UiApp works, but is slow because of the network.
The HtmlService solution here Populate jQuery autocomplete list using value array from Google Spreadsheet is much better.
A UiApp version: https://sites.google.com/site/scriptsexamples/learn-by-example/uiapp-examples-code-snippets/suggest-box
Or this way that I built:
To see it in action, type an airport name into: http://www.treesforlife.org.au/carbon-calculator
But this was is done with spreadsheet formulas, not google-apps-script. see http://www.cellmaster.com.au
See http://googleappsdeveloper.blogspot.in/2011/05/autocomplete-email-addresses-in-apps.html for an example of autocomplete
It's fairly easy in HtmlService and a bit harder in UiApp although doable. Here's an HtmlService example:
Code File
function getGroup(group) {
return GroupsApp.getGroupByEmail(group).getUsers().map(
function(user){return user.getEmail(); });
}
function doGet() {
return HtmlService.createHtmlOutputFromFile("ui");
}
Html file named 'ui'
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<script>
function refresh() {
google.script.run.withSuccessHandler(function(tags) {$( "#tags" ).autocomplete({source: tags});})
.getGroup(document.getElementById('group').value);
}
</script>
Enter a group name in the first box. The second box will autocomplete
group members using GroupApp.
<br>
<label for="group">Group: </label>
<input id="group" onchange='refresh()'>
<div class="ui-widget">
<label for="tags">Members: </label>
<input id="tags">
</div>
</html>