Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Script Talk › Date/time picker in prompter dialog (2)
- This topic has 4 replies, 2 voices, and was last updated 5 years ago by
Sam Moffatt.
-
AuthorPosts
-
October 19, 2020 at 1:45 PM #42308
Chris JuParticipant(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
ChrisOctober 20, 2020 at 12:58 AM #42314
Sam MoffattParticipantThe third parameter is a field type but I don’t think
date_timeis 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 JuParticipantThanks 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 JuParticipant… and how can i automatically open the created record after confirming prompt?
Life is difficult… ;-)
October 21, 2020 at 8:26 PM #42342
Sam MoffattParticipantgetFieldsForTypeis 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
openUrlto open a record, something like this should work:Utils.openUrl(targetRecord.getUrl());Change
targetRecordto be the variable of the record you want to open. -
AuthorPosts
You must be logged in to reply to this topic.