html - Google Sites checkbox value in Google Spreadsheet -
on google sites on edit mode, have prepared checkbox using insert - html box
and within html box following code..
<style> div{ width:100px; height:30px; } </style> <script> function putresult(e) { var ss = spreadsheetapp.openbyid("0akkxdnrvyzqzde1yu21frgj6akj6mmzisvhtn0jmnnc"); var calc = ss.getsheetbyname("customer"); var chvalue = e.parameter.bike calc.getrange("c3").setvalue("chvalue"); } </script> <div> edc: <input type="checkbox" id="bike" onclick="putresult(e)"> </div>
now requirements:
- i want true/false based on checkbox populated in ss.calc (c3) sheet.
- the page should automatically refreshed each time checkbox clicked.
i novice , in learning stage. please shout if things unclear.
ps:
- i copied code within gas, that's
e.parameter.bike
comes from, don't know if that's right way... - i have inserted chart in google sites source data spreadsheet (insert chart), want make dynamic using checkboxes.
think html box not accepting onclick , not sure inspecting checkbox in firebug can see there no onclick element.
think can using google app script follows, in code.gs file,
function doget() { return htmlservice.createhtmloutputfromfile('test').setsandboxmode(htmlservice.sandboxmode.native); }
and have file called test.html.this can created file --> new --> script file, in have following code,
<style> div{ width:100px; height:30px; } </style> <script> function putresult() { var ss = spreadsheetapp.openbyid("0akkxdnrvyzqzde1yu21frgj6akj6mmzisvhtn0jmnnc"); var calc = ss.getsheetbyname("customer"); var chvalue = document.getelementbyid('bike').value; calc.getrange("c3").setvalue("chvalue"); } </script> <div> edc: <input type="checkbox" id="bike" onclick="putresult()"> </div>
i haven't tested above code.try if works you.
Comments
Post a Comment