0

The following is a partial example of a date-time picker widget handler function. This handler simply logs a string representing the date-time chosen by the user in a date-time picker widget with the ID "myDateTimePickerWidgetID":

function handleDateTimeChange(event) {
    var dateTimeInput =
      event.commonEventObject.formInputs["myDateTimePickerWidgetID"];
    var msSinceEpoch = dateTimeInput.msSinceEpoch;
    var hasDate = dateTimeInput.hasDate;
    var hasTime = dateTimeInput.hadTime;
    ...

I cannot find anywhere in the reference where to set or get this ID

https://developers.google.com/apps-script/add-ons/concepts/widgets#:~:text=The%20following%20is,%C2%A0%20%7D%0A%7D

I have tried using the example "myDateTimePickerWidgetID".

Rubén
  • 34,714
  • 9
  • 70
  • 166
mbarrett
  • 1
  • 1

1 Answers1

0

Full disclosure: it's been a little while since I've used the Cards Service, but if I recall, the "ID" you're looking for may be the field name you supplied in the constructor of the DateTimePicker widget using the setFieldName function.

EDIT I found an older thread that clarifies the point: In Google Apps Script action handler, how to get value of a selection input?

great_pan
  • 246
  • 6