addTextField with number for name in Drafts 40

Hello —

For a while I’ve had a Drafts action that included approximately this script:

const doPrompt = Prompt.create();

doPrompt.title = “Title”;

doPrompt.addTextField(0, "", "");

doPrompt.addTextField(1, "", "");

doPrompt.addTextField(2, "", "");

doPrompt.addTextField(3, "", "");

doPrompt.addButton(“OK"); and etc ...

The salient point being that the “name” string for addTextField() was a number and it worked just fine. As of Drafts 40 or 40.0.1 (339) (I’ve got 40.0.1 installed now but I think this started with Drafts 40 proper), this script no longer functions (shows a prompt with the title and the OK button, but not the text fields). However, if I change the “name” string to an actual string (words or numbers within quotation marks), then the prompt works as expected.

Bug in the new Drafts version, or have I been getting away with something previously that wasn’t a best practice and I need to start making my “name”s actual strings?

Excited for the new nested tags and etc. Thanks!

Did this change relate to an update to iOS 17, or just an update to Drafts on iOS 16?

Also, are there any messages in the action log after running? We added more parameter checking in this update to output error for bad parameters - which these are. They should be strings.

It was updating Drafts on iOS 16; this was happening before I updated my iPhone on Monday, and it’s not happening on my iPad, where I have updated to iPadOS 17 but have not yet updated Drafts over there.

But yes :man_facepalming:t2:, I see now there are messages in the action log — “Prompt.addTextField: Name and label parameters required.” So my bad; I was perhaps benefiting from a bug for a while, using a number as a string, but no big deal now to modify the script accordingly.

Thanks for the quick reply. Happy update season!