Modify an HTML object with Javascript in a Google Script -
like of other examples provided google on google scripts, modifying html through javascript inside success handler doesn't seem work.
the example is:
<script> function updateurl(url) { var div = document.getelementbyid('output'); div.innerhtml = '<a href="' + url + '">got it!</a>'; } </script> <form id="myform"> <input name="myfile" type="file" /> <input type="button" value="submit" onclick="google.script.run .withsuccesshandler(updateurl) .processform(this.parentnode)" /> </form> <div id="output"></div>
and i've done quite similar:
<script> function clearlist(somevalue){ document.getelementbyid('studentsform').reset() } function setstatus(somevalue){ var status = document.getelementbyid('status'); status.innerhtml = 'remark posted.' } </script> <form name='studentsform' id='studentsform'> <select name='student'> <option value='none'>select student...</option> options </select> <br> <br> <textarea name='comment' rows='10' cols='35'>type comment here</textarea><br><br> <input type='button' value='submit' onclick='google.script.run .withsuccesshandler(setstatus) .processremark(this.parentnode)'> </form> <div id="status"></div>
i've tried running both clearlist() , setstatus() functions neither affected html gui thought server-side function run successfully.
is there else done work? thanks.
edit: in fact, illustrate problem isn't server-client communication issue (as far understand it), here simplified version of code, html isn't modified through script function call:
<script> function setstatus(){ var status = document.getelementbyid('status'); status.innerhtml = 'remark posted.' } </script> <input type='button' value='test' onclick='setstatus();'> <div id="status"></div>
just realised input file, doesn't work way iframe sandbox, see issue 4610, workaround present in posts.
here's workaround multiple files: uploading multiple files google drive google app script
Comments
Post a Comment