Date/time picker in prompter dialog (2)

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Script Talk Date/time picker in prompter dialog (2)

Viewing 4 reply threads
  • Author
    Posts
  • October 19, 2020 at 1:45 PM #42308

    Chris Ju
    Participant

    (first topic was marked as spam)

    Hi,

    i’m using the prompter dialog to enter text and date/time for a new cild record:

    let prompter = Prompter.new();
    prompter.addParameter(‘Note:’, ‘note’, ‘text’)
    .addParameter(‘DateTime:’, ‘datetime’, ‘date_time’)
    .show(‘Message prompt’, callbackFunction);

    The field “Note” is filled with the texted i entered in the dialog, but “DateTime” is still empty. What is wrong with my script?

    Is it possible to add days/weeks/years (choosing from picklist in the prompter dialog) to the current date and add the result in the DateTime field in the created record?

    Thanks
    Chris

    October 20, 2020 at 12:58 AM #42314

    Sam Moffatt
    Participant

    The third parameter is a field type but I don’t think date_time is a valid type, certainly it doesn’t appear in the documentation.

    This populates the variables how I expect them on TF 5.3.15 (972):

    var note;
    var datetime;
    function callbackFunction() {
    	console.log('Callback');
    	console.log('Note:');
    	console.log(note);
    	console.log('Date Time:');
    	console.log(datetime);
    }
    
    let prompter = Prompter.new();
    prompter.addParameter('Note:', 'note', 'text')
    .addParameter('DateTime:', 'datetime', 'date_time')
    .show('Message prompt', callbackFunction);
    
    October 21, 2020 at 7:42 AM #42334

    Chris Ju
    Participant

    Thanks for your suggestion. Still does not work. Where can i find the documentation?

    I took “date_time” from https://www.tapforms.com/help-mac/5.3/en/topic/javascript-api

    Attachments:
    You must be logged in to view attached files.
    October 21, 2020 at 8:57 AM #42336

    Chris Ju
    Participant

    … and how can i automatically open the created record after confirming prompt?

    Life is difficult… ;-)

    October 21, 2020 at 8:26 PM #42342

    Sam Moffatt
    Participant

    getFieldsForType is for getting fields from a form not for the prompter, the prompter section at the bottom has a list of the supported types as the examples.

    You can use openUrl to open a record, something like this should work:

    Utils.openUrl(targetRecord.getUrl());
    

    Change targetRecord to be the variable of the record you want to open.

Viewing 4 reply threads

You must be logged in to reply to this topic.