Custom checklist/radiobutton selection dialogs for Drafts 21

Matt - thanks, very helpful. I know I’m on the right track, but still not there yet, and embarrassed that I still have another question. I’m using

draft.setTemplateTag("folderTag",selectedItems);

and I’m getting the correct integer of the number of the selected item’s position in the list. (I got the same result using prompt.selectedItems.) I’m trying to use the title from the selected item as the variable. Is that possible, or do I have to create a separate switch statement, using the integer from the selectedItems variable?

Thanks for the response, Matt.

1: this targets the filter field (it shows the active highlight colour) but doesn’t place the cursor there (or activate the on-screen keyboard)…

2: the display bug is something to do with live-filtering— those spaces only appear when text is entered in the filter field.

Can send the HTML, but this might also be useful: video of filter display bug

Matt will be able to answer this more accurately, but to at least attempt to point you in the right direction, I’m thinking you’d be able to access the title if you set your variable as array[selectedItems] (where “array” = could be replaced with whatever the name of the array holding your folder names might be)…

As noted in this thread, selectedItems is just an array of the indexes (positions, starting at zero) of the items that were chosen. You need to then obtain the corresponding actual item from whatever data you initially put into the prompt. For example, if you had an array of paths and used an MGCheckListPrompt to pick some of them, you’d then use the indexes in selectedItems to retrieve the relevant paths from the original array.

I appreciate that that’s probably a pretty opaque answer and you’re just trying to get this working! My general advice would be to read about arrays in JavaScript (I sense you haven’t done much programming?), but if you post your specific Script step then I’m sure someone will show you how to do it in this particular case.

1 Like
  1. Works on my iPad, but I see it doesn’t work on the phone. I suspect that something else might be snatching the keyboard focus. No guarantee that I can fix that, but I’ll fiddle with it when I have some time.

  2. I really do need the actual HTML. I already suspect I know what sort of problem it is (to do with how the live filter highlighting inserts/removes HTML into list items), but I need to see what’s really happening.

Martin, I am proud to say I do understand what you’re talking about, even if I do not yet understand how to do what you are talking about. :hear_no_evil: For now, I used a Switch statement. It probably doubling the work, but it’s all working great. Thanks!

He’s Matt, by the way. :slight_smile:

1 Like

Haha, sorry Matt - this lack of attention to detail may partially explain my slow learning curve on this stuff!

2 Likes

The link to the documentation is broken… both here and in the action group

Sorry about that. It should be fixed now.

1 Like

Matt: I know I’ve said it before, but there’s a warm place in my heart for this prompt/library. If pushed to recommend an action that has most deeply transformed my use of Drafts, this would be it. That might sound a bit hyperbolic, but the foundation the prompt and library provide has powered a few of my most cherished workflows. Many, many thanks for making it.

2 Likes

You are absolutely welcome (once again)!

1 Like

@mattgemmell, thanks so much for sharing. The design and documentation of the MGCheckListPrompt action group are so well done! I’ve use the MGCheckListPrompt Library in an action I’ve recently shared: Add Lines to List

Hi Jim! That’s cool. You’re very welcome for the prompt. Glad that my ridiculously over-engineered code is still useful!

1 Like