createtiddler title from a field on the tiddler

59 views
Skip to first unread message

Ankit

unread,
Jul 20, 2020, 9:03:36 PM7/20/20
to TiddlyWiki
I am trying to create a tiddler based on value stored in a field on the tiddler... I am not sure what I am doing wrong but it is not working even though same value when just entered plainly on tiddler returns correct value.

I will explain what I am trying to achieve:

  1. I have a tiddler with a button named "New Project"
  2. On click of the button a modal is opened for user to enter the Project Name.
  3. This project Name is saved in a field named project_name_from_modal
Now at this point I have tried both from the modal as well as the page with the button following code but it does not get the value of the project-name. Instead it takes the value used to invoke the field value

<$action-createtiddler
$basetitle={{!!project_name_from_modal}}
tags= 'Projects'
$savetitle="!!project_home_page_name_created"
$overwrite='yes'/>

I then tried the variation to this using a macro on modal as shown below:

\define project_home_page_name() {{$(calling_page)$!!project_name_from_modal}}

<$action-createtiddler
$basetitle=<<project_home_page_name>>
tags= 'Projects'
text='{{$:/newproject}}'
$savetitle="!!project_home_page_name_created"
$overwrite='yes'/>

I also tried the macro approach on the page with the button

\define project_home_page_name() {{!!project_name_from_modal}}

<$action-createtiddler
$basetitle=<<project_home_page_name>>
tags= 'Projects'
text='{{$:/newproject}}'
$savetitle="!!project_home_page_name_created"
$overwrite='yes'/>

Strangely if say I enter on the field in modal "ABC" the {{!!project_name_from_modal}} as well as macro <<project_home_page_name>> both show the output "ABC" but when i try using them on action-createtiddler it just created a tiddler with title {{!!project_name_from_modal}} instead of "ABC".

Please can someone guide me on what am I messing up here :(

Mat

unread,
Jul 20, 2020, 9:10:44 PM7/20/20
to TiddlyWiki
Prolly ain't it but I note this

tags= 'Projects'

in your examples.

Also you do know that the action-createtiddler widget cannot be "on it's own", it has to be inside a buttonwidget or other widget that executes the actions.

<$button>
your actions here
</$button>

<:-)

Saq Imtiaz

unread,
Jul 20, 2020, 9:33:57 PM7/20/20
to TiddlyWiki
@ankit I'm a bit too bleary eyed right now to debug code, but if you don't mind the uglier UI this might be helpful:

https://github.com/saqimtiaz/streams/blob/master/plugins/streams/widgets/action-withinput.js

I have a modal version somewhere as well that mostly works, would need to dig it up. IIRC the only issue was the input field in the modal didn't receive focus automatically when the modal was opened.

Ankit

unread,
Jul 21, 2020, 2:26:19 AM7/21/20
to TiddlyWiki
Thanks Mat. The examples are what I just typed here to give an overview of what I am doing as copy pasting entire thing would have been too long and I feared would be a turn off for people.

Actually after posting it, I tried writing another button and called the same action from within it and it worked.

So perhaps it was some sort of sequencing issue...it was 2 AM here at the time and I was too tired to bother anymore but will look into it today.

Regards,
Ankit

Ankit

unread,
Jul 21, 2020, 2:32:49 AM7/21/20
to TiddlyWiki
Thanks Saq, I had a quick look and it appears to be a javascript plugin... way beyond my skill level so hugely appreciated as it will help me learn something new but I suspect I will need more help on this topic in form of understanding the flow of user input after it being saved in a field to the point where the string manipulation can be carried out using wikify widget and applying simple conditional checks.
Reply all
Reply to author
Forward
0 new messages