javascript - Html UI not outputting correctly in google spreadsheet -


i'm kind of new using coding may missing obvious here. i'm looking create output here in discussion: how can add multiple inputs html ui google spreadsheet?. used same code format, somehow form blank when execute code? here code modified:

    additem.gs     function openinputdialog() {       var html = htmlservice.createhtmloutputfromfile('index');       spreadsheetapp.getui()            .showmodaldialog(html, 'make booking');     }      function itemadd(form) {   var ss = spreadsheetapp.getactivespreadsheet();   var sheet = ss.getsheets()[0];   sheet.appendrow(["  ", form.name, form.room, form.guesthouse, form.checkin, form.checkout, form.department]);   return true; } 

the html form:

index.html     <!doctype html> <html>   <head>     <base target="_top">   </head>   <br>   <form>     name:<br>     <input type="text" name="name">     <br>     room:<br>     <input type="text" name="room">     <br>     guesthouse:<br>     <input type="text" name="guesthouse">     <br>     in:<br>     <input type="date" name="checkin">     <br>     out:<br>     <input type="date" name="checkout">     <br>     department:<br>     <input type="text" name="department">     <br><br>      <input type="button" value="submit"         onclick="google.script.run             .withsuccesshandler(google.script.host.close)             .itemadd(this.parentnode)" />     </form> </html> 

when run function, form has dialog "make booking", rest of form blank. i've scoured net doing wrong, unsuccessfully of course.

any appreciated.

i used of code , should work you. code.gs:

function addmydata(form)  {   var sh=spreadsheetapp.getactive().getactivesheet();   sh.appendrow([form.name,form.room,form.guesthouse,form.checkin,form.checkout,form.department]); }  function showmydialog() {   var userinterface=htmlservice.createhtmloutputfromfile('htmlhelp');   spreadsheetapp.getui().showmodelessdialog(userinterface, 'title'); } 

htmlhelp.html:

<!doctype html> <html>   <head>   <title></title>   </head>   <body>   <form>     name:<br>     <input type="text" value="" name="name">     <br>     room:<br>     <input type="text" value="" name="room">     <br>     guesthouse:<br>     <input type="text" value="" name="guesthouse">     <br>     in:<br>     <input type="date" name="checkin">     <br>     out:<br>     <input type="date" name="checkout">     <br>     department:<br>     <input type="text" value="" name="department">     <br><br>      <input type="submit" value="submit" onclick="google.script.run.addmydata(this.form);google.script.host.close();" />     </form>     </body> </html> 

note: google.script.host.close() not work deployed webapp.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -