Returning a value using Date picker in HTMLService / Google Apps Script

前端 未结 1 938
忘了有多久
忘了有多久 2020-12-20 02:55

I\'m trying to capture a date range that will be used inside a Document container-based GAS. I\'ve been successful displaying a dialog box that shows two jquery datepicker

1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-20 03:29

    Prepare a server-side function to receive your input. This one only logs it:

    function submitDates(startDate,endDate) {
      Logger.log(JSON.stringify(arguments));
      // To send error messages, throw an exception.
      // e.g. if (invalid) throw new error("Invalid date")
    }
    

    Change the button handler in your html. Instead of closing the dialog, collect the input data and pass it to the server function using google.script.run. Attach handler to the runner; a success handler will close the window, for example. A failure handler will display server-side errors.

    
    

    Add this script to the bottom of your html:

    
    

    0 讨论(0)
提交回复
热议问题