JavaScript Qs in current v. 5.3.3 (896) iOS

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Using Tap Forms JavaScript Qs in current v. 5.3.3 (896) iOS

Tagged: 

Viewing 1 reply thread
  • Author
    Posts
  • December 22, 2018 at 9:36 PM #32954

    David Salgueiro
    Participant

    Hi Brendan,

    I’ve noticed a couple of weird things while building my first Form script. Not sure if I’m just being a noob (probably am).

    Does alertWithMessage stop execution? Is this intended behaviour? If so, is there an alternative that won’t halt execution on iOS? Example:

    Utils.alertWithMessage('test', 'this message will display');
    Utils.alertWithMessage('test', 'this message will NEVER display');

    Also:
    Utils.alertWithMessage('test', '0 time: ' + new Date(0));

    Displays:
    test
    0 time: Thu Jan 1 1970 00:00:00 GMT+0000 (GMT)

    However, if I assign that value to a blank date field, formatted to display as HH:mm, with Set Current Time as OFF, using the code:
    record.setFieldValue(test_time_id, new Date(0));

    I get a value of 01:00, when I would expect a value of 00:00.

    If I adjust for it, with the code:
    record.setFieldValue(test_time_id, 0 - 60*60*1000);

    … then I get the value of 00:00.

    (I seem to remember an old TF bug similar to this many, many moons ago — I wonder if it has come back to haunt :) ).

    Thanks for your help, as always.

    Merry Christmas!

    December 23, 2018 at 2:01 AM #32961

    Brendan
    Keymaster

    Hi David,

    The alerts are shown asynchronously. If you want to continue code execution after you display an alert, use the Prompter() class instead. That has a callback method you can provide as a parameter that will let you continue execution after a button is clicked.

    If you want the current date, just use new Date() without passing in the 0.

    https://www.w3schools.com/jsref/jsref_obj_date.asp

    But the value displayed in a Date field will depend on the time zone you’re located in. Are you 1 hour off of GMT?

Viewing 1 reply thread

You must be logged in to reply to this topic.