In the below form: https://script.google.com/macros/s/AKfycbwTGqZqLTAsOpSweMn0xgHP0sOJPsFg5ZShC1HqzVoDoNi5h5Y/exec
I'm trying to dynamically update the option list from a column in this sheet: https://docs.google.com/spreadsheets/d/1_LSdBkvw5Z6L4ZQP5qZccLEfekNVRCeKQRLLb9Vm4eM/edit#gid=285745421
I'm using The solution provided by "Ziganotschka" here: How to auto populate form options based on a column in the attached spreadsheet
The code is not giving any errors, still for some reason it gives an empty list of options in the form
Thanks in advance
Code.gs
function createInnerHTML()
{
var ss = SpreadsheetApp.getActive();
var names = ss.getSheetByName("CHOICES");
var namesValues = names.getRange(2, 2, names.getMaxRows() -
1).getValues();
var InnerHTML = [];
for (var i=0;i<namesValues.length;i++){
InnerHTML.push('<option value="OPTION '+(i+1)+'>' + namesValues[i][0]+ '</option>');
};
InnerHTML.join('');
return InnerHTML;
}
index.html
<div class="ss-q-title">JOINT
<span class="ss-required-asterisk" aria-hidden="true">*</span></div>
<? var innerHTML= createInnerHTML(); ?>
<div>
<select name="JOINT" id="JOINT" aria-label="JOINT " aria-required="true" required="">
<option value=""></option>
//HERE the inner HTML will be inserted
<?= innerHTML?>
</select>
</div>