Autocapitalization in script (SOLVED)


I have just started looking at scripting and am having an issue that will probably turn out to be really obvious! I’ve tried the Drafts scripting help.

I have the following, simplified, script.

var p = Prompt.create();
p.title = "Test";

p.addTextField("firstname", "Firstname", "", {autocapitalization:"words", keyboard:"default", wantsFocus:true});


var con =;

if (con) {
    var fname = p.fieldValues["firstname"];

    var d = Draft.create();
    d.content = fname;

else {

No matter what I try, the autocapitalization does not happen. No errors are shown, the output is simply the same as the (lowercase) input. I have also tried the sentences option with the same result (no uppercase).

If I try setting the keyboard option to numberPad the correct keyboard is shown, so the options are being read.

Anyone spot what I am missing?

Thanks in anticipation.

That script works fine for me. As I type each word it is switching to capitalise the first letter as I type. That’s on an iPhone, with both SwiftKey and inbuilt Apple onscreen keyboards.

I also checked to see if the capitalisation setting in the editor settings affected it, but it worked the same regardless.

Using a hardware keyboard, that doesn’t auto capitalise as that’s not a dynamic key entry - it won’t miraculousy transform into a keypad for numeric entry for example. That applies to using my hardware keyboard with my phone and with my Mac.

What platform and what keyboard are you using?

1 Like

@sylumer Thanks for the fast reply. I’m on an iPhone 11 Pro Max, iOS 14.5 (full release, not the beta) and using the standard iPhone on screen keyboard. Drafts app is up to date (26.2.4) and my Pro subscription is active.

video of it running for me.

I’ve just tried it on my iPad Pro 12.9” 2018 (iPadOS 14.5 full release) and it is working correctly.

I’ll keep digging.


I had, at some stage in the dim and distant past, switched off Auto-Capitalisation in Settings > Keyboards (iPhone settings, not Drafts) and that was over-riding the script setting.

Thanks for your help @sylumer – the confirmation it was working for you and your explanation of how it should work triggered solution.

Thanks for changing that title to solved - a very neat thing and a great sign for others looking for solutions.