How to navigate to a specific tiddler and focus the edit-text?

I get a tiddler named “CreateTask” like this:

<hr />

<$edit-text tiddler="OriVariableTempTid" focus="yes" field="TaskTitle"/> 


<$button class="CreateTaskTiddler">
<$action-createtiddler $basetitle={{OriVariableTempTid!!TaskTitle}} tags="task" text={{TaskTodoTextContentTemplate}}>
<$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>
Create Task Tid
</$button>

With a edit-text widget with the option focus to yes. But the focus works only if when create the edit-text.

So I make a shortcut with content:

<$navigator story="$:/StoryList" history="$:/HistoryList">
<$action-sendmessage $message="tm-close-tiddler" $param="CreateTask" />
</$navigator>


<$navigator story="$:/StoryList" history="$:/HistoryList">
<$action-navigate $to="CreateTask"/>
</$navigator>

So I think no matter it exists or not I close it first, I will always create the tiddler.

But in this case, when press the shortcut I specified, it wont close the tiddler.
May be it closed but to fast I havent notice that. But the result is if the “CreateTask” tid already exists. The focus not work. So how to fix it?

Did you try, https://tiddlywiki.com/#WidgetMessage%3A%20tm-focus-selector ?

Thank you I will try it. But I also want to know why my code is wrong?

This worked thank you


<$navigator story="$:/StoryList" history="$:/HistoryList">
<$action-navigate $to="CreateTask"/>
</$navigator>


<$navigator story="$:/StoryList" history="$:/HistoryList">
<$action-sendmessage $message="tm-focus-selector" $param=".NewTaskTitle" />
</$navigator>

1 Like