Google App Maker - Add a button for timestamp collection in the onclick method

后端 未结 2 1586
我在风中等你
我在风中等你 2021-01-28 01:49

I searched high and low and cannot find a specific answer that works. I need to add a button to a form in App Maker to record a timestamp, not a date, when clicked. So far the o

2条回答
  •  滥情空心
    2021-01-28 02:17

    Success! With the help of everyone here and the guys at this link: Google Groups - Solution I've managed to crack the case (and learn some stuff along the way).

    Everything originally above works just fine if you take the " + " out of the function so it reads

    function getTimeStamp(){
    var timestamp = new Date();
    return timestamp;
    }
    

    Then, onclick of

    var timestamp = getTimeStamp();
    widget.datasource.item.Timestamp_IN = timestamp;
    

    Next, format the table to show the correct data with

    @datasource.item.Test_Timestamp#formatDate('EEEE \x27at\x27 h:mm:ss a')
    

    And "Hey Presto!" you get a button that, when clicked, gives you a timestamp. Thaks to everyone who pitched in, you're the reason people who are learning continue to do so and don't throw in the towel when things get difficult :)

提交回复
热议问题