Search Results for 'script'
-
Search Results
-
Topic: Scripting on iPad
I’d like to start by saying:
I had started using Tap Forms when Bento became obsolete. I loved it! When Tap Forms Pro came out I subscribed, iPad only, even though I’m no fan of subscription based apps. I let the subscription lapse because I didn’t see the value. However, the new updates called me back, and I renewed my subscription. I’m still not a fan of subscriptions, but I feel this one is worth it. I still don’t use it on my iMac. I need the iPad version only, so I’m hoping more of the Mac functionality comes to the iPad. Leading to my question!
Does scripting work okay on the iPad? I don’t mean, do scripts work, I mean writing them. There’s so little iPad documentation, I’m not sure what I can do.I’ve a simple form with two date fields (start and end) and some other fields. The first date field is populated with the current date. The second date field is empty. And some fields are hidden until the second field contains a date. To make it easier for the user, I’ve added a button to a Universal layout. When I click the button, the date field should be filled with the current date. I use this script for the task:
function MyScript() { var field_id = 'fld-b64c54dfb3de446fbf2b25b203c90104'; record.setFieldValue(field_id, new Date(), true); record.refreshCalculations(); form.saveAllChanges(); document.saveAllChangesAndRefresh(); record.refreshCalculations(); } MyScript();As you can see, I tried a lot to make the button work. But it doesn’t. After clicking, nothing happens. When I click on an empty area of the form, the second date field shos its content. But the hidden fields are still hidden, I’ve to switch layouts or record to let Tap Forms update the screen.
Is there a way to refresh the view? Or did I something wrong?
Hi Brendan,
I’ve noticed what seems to be a grouping issue with Number fields in Tap Forms Pro.
If a Number field contains a value and I delete that value, the field correctly appears empty. However, when I use this field with Group Records By, the record is placed in the 0 group, as if the empty field actually contained the value 0.
I checked the value with a script:
var value = record.getFieldValue(‘fld-0de…….’);
if (value === undefined) {
return “UNDEFINED — no value”;
}return “VALUE: ” + value;
For the affected record, the script returns:UNDEFINED — no value
So the Number field really is empty and does not contain 0. It seems that Group Records By is treating undefined and the numeric value 0 as the same grouping value.
Would it be possible for empty Number fields to remain in a separate empty group, rather than being grouped together with records whose value is actually 0?
Thanks!
Hi Brandon,
hi all,I have been experimenting with a script in the last couple of days and ended up with a reproducible crash of Tap Forms with one version of it, that I thought that someone might want to look into. (Disclaimer: AI helped me write the script as my capabilities in JavaScript are beginner level at best).
What I was doing: I have a script button on a custom layout that lets me pick an existing record from another form and link it via record.addRecordToField(), using Prompter.new() with a ‘popup’ parameter to show the choices. To add several linked records in one go, we wrapped that in a while loop and added a second Prompter (a simple Yes/No confirm using addParameter(message, null, “label”)) asking “add another?” after each pick.
The bug: As soon as this script has two different Prompter-based functions in it — even though the second one (the confirm) is never actually reached — the very first prompt crashes the whole app the moment I click its Continue button. It’s 100% reproducible, happens both from the live layout button and from the script editor’s own Run button, and happens regardless of which item I pick in the dropdown (including leaving it on the default first item).
If I strip the script down to a single Prompter call with no loop and no second Prompter function anywhere in the script, it works perfectly every time.
Here’s the full script that causes the crash:
async function Pick_Subtheme() {
await pickSubtheme();
}async function pickSubtheme() {
var keepAdding = true;
while (keepAdding) {
var chosen = await promptPopup(“Add a Subtheme:”, “Pick Subtheme”, [“Episode IV – A New Hope”, “Episode VI – Return of the Jedi”, “Classic Star Wars”, “Lego Star Wars – Ultimate Collector’s Series”]);
if (!chosen) { keepAdding = false; break; }
// … link the chosen record …
keepAdding = await promptConfirm(“Add another Subtheme?”, “Add Subtheme”, “Done”);
}
}function promptPopup(message, popupName, valuesArray) {
return new Promise(function (resolve) {
choice = undefined;
var p = Prompter.new();
p.addParameter(message, “choice”, “popup”, valuesArray, valuesArray[0]);
p.cancelButtonTitle = “Cancel”;
p.continueButtonTitle = “Add”;
p.show(popupName, function (status) {
resolve(status === true ? choice : false);
});
});
}function promptConfirm(message, continueTitle, cancelTitle) {
return new Promise(function (resolve) {
var p = Prompter.new();
p.addParameter(message, null, “label”);
p.cancelButtonTitle = cancelTitle;
p.continueButtonTitle = continueTitle;
p.show(message, function (status) {
resolve(status === true);
});
});
}var choice;
Pick_Subtheme();The crash happens the moment I click “Add” on the very first popup — execution never even reaches promptConfirm.
Crash log (Thread 0, the crashed thread):
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Reason: *** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]Termination Reason: Namespace SIGNAL, Code 6, Abort trap: 6
Terminating Process: Tap Forms Pro [31720]Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
…
10 CoreFoundation -[__NSArrayM objectAtIndex:] + 592
11 Tap Forms Pro 0x104f1a564 0x104dd0000 + 1353060
12 CoreFoundation __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
…I am using Tap Forms Pro 1.3.1 (Build 560) with macOS Tahoe 26.6.2.
I’m happy to send the full crash report if useful. Thanks for looking into it!
Melanie