I am trying to get the selected radio button and push it into another script via html service. However I do not know how to push the selected radio button in google script.
Index.html
<div>
<?
var attrs = getAllDrawings();
for(i=0; i<attrs.length;i++){
?>
<INPUT TYPE="Radio" Name="Drawing" Value= "<?= attrs[i] ?> "> <?= attrs[i] ?> <br>
<? } ?>
<input type="submit" value="submit"
onclick="google.script.run.getDrawing(result)" />
<input type="button" value="Close"
onclick="google.script.host.close()" />
</div>
What do I use instead of result in google.script.run.getDrawing(result)
so I can run a function based on it
function getDrawing(e) {
Logger.log(e);
}
I am creating an html template with a list of files in a folder. The user then selects the needed file, and I need to return the URL for that file to the user. However I do not know how to return the file that the user has selected.
So I need to get the selected radio button value. For example if radios are Spreadsheet1, Spreadsheet2, Spreadsheet3 and Spreadsheet4 and 3rd one was selected which is Spreadsheet3 how can I run getDrawing("Spreadsheet3")
.
Mu problem is similar to this SO problem, but I am using HTML instead of UIApp.
Edit:
This is how I call Index.html
function demoHtmlServices() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var html = HtmlService.createTemplateFromFile('Index').evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME);
ss.show(html);
}