I am trying to create an action to append to a page in TrunkNotes, using a Prompt step to get the page title. The key in my prompt step is “PageTitle”. The URL step is setup as:
tn:///append?page=[[PageTitle_input]]&content=%0A[[draft]]
However, clearly “PageTitle_input” is not the correct tag. Using “PageTitle_button” “works”, in the sense that it replaces the tag with the button text, “OK”. How can I use the input field in my URL action?
I was going to delete this, after I found the solution in the Documentation, but I thought I’d leave it up in case anyone has the same issue; it turns out [[prompt_text]] ([[PageTitle_text]], in my example) is what I was looking for.
3 Likes
thanks for this Adam … off to implement!
A little clarification on this “button vs. text” problem. I have developed a library of Actions (in Drafts v4) that are dependent on component Actions, i.e. building blocks or Lego. Whenever I have an Action that would like to prompt for a choice OR enter a value not in a list (e.g. filename extensions, tags):
- I create a Prompt Step where:
- The Prompt Key = choice
- Include text field = enabled
- I provide an Input Default
- I always Include cancel button
- And I make the last Buttons Buttons entry OK.
- The next Step in my Action is to include a Script titled: choice_text OR choice_button (query0) - I actually have three (3) of these scripts: query0, query1, query2, because some of my Actions include multiple Prompts.
- choice_text OR choice_button (query0) contains:
//step to input text or get pre-set button text
var q = '';
var qtext = draft.getTag('choice_text');
var qbutton = draft.getTag('choice_button');
if( qbutton == "OK" )
{ q += qtext } // pass along user input
else
{ q += qbutton } // pass along selected button
var query0 = draft.defineTag('query0',q)
- Finally, I use [[query0]], [[query1]], or [[query2]], wherever needed in the remainder of the Action.
I hope this helps.
1 Like