My client has a huge list of contacts. I created a form with a scrolling list, in order to select a contact. The issue is that the scrolling list is too long. Is there a way (and if so, how?) for my client to start typing the first letters of a contact name, so the 'field area' (or other) fills in automatically the correspondant contact name? Thank you in advance for your help. Kind regards,
Asked
Active
Viewed 195 times
-1
-
What suggests Momin requires that you drop the google form and write an app script application that serves a web page: https://developers.google.com/apps-script/guides/html/ – Matteo Ragni Oct 26 '17 at 15:24
-
So if i understand. I create a form with https://developers.google.com/apps-script/guides/html/ and it's in this form i can make some ajax-like ? (i am a php dev not javascript and i start with the google app script) – Pierre LI VIGNI Oct 26 '17 at 15:32
-
exactly. You have to write both the client (as HTML+JS page) and the server (that replies to certain AJAX request in order to query App Script accordingly) – Matteo Ragni Oct 26 '17 at 15:33
1 Answers
0
You can load the select with this javascript:
function updateSelect(vA)
{
var select = document.getElementById("sel1");//or whatever you select id is
select.options.length = 0;
for(var i=0;i<vA.length;i++)
{
select.options[i] = new Option(vA[i],vA[i]);
}
}
The html select element:
<select id="sel1">
<option value="" selected></option>
</select>
I often load selects when the page loads with something like this:
$(function(){
google.script.run
.withSuccessHandler(updateSelect)
.getSelectOptions();//a gs function which passes an array to updateSelect via the success handler
});
That way I can use a spreadsheet to store the values that I want. In your case you may want to filter them alphabetically perhaps. And you might want to pass the getSelectOptioptions() function or whatever you call it a parameter to determine how to filter the list.

Cooper
- 59,616
- 6
- 23
- 54