Passing sending tiddly name to target of button press

51 views
Skip to first unread message

cw

unread,
Mar 21, 2021, 11:48:23 PM3/21/21
to TiddlyWiki
I have imported some BibTeX references into TW. I have a field in the reference tiddly called "comment". 

I want to be able to edit that comment - and I understand that has to be done in another tiddly

so the body of the reference tiddly:

{{!!bibtex-title}}
BibTeX key: {{!!title}}
Status: {{!!status}}
Comment: 
<hr>
{{!!comment}}
<hr>

<$button to="TempCommentEdit"  set="TempCommentEdit!!comment" setTo={{!!comment}}>

Edit Comments

</$button> 

That button goes to the target tiddly (TempCommentEdit") and sets its comment field to the originator's comment field, and I can edit it.

I would like to be able to "do the reverse" and set the comment field of the "originator" tiddly to the edited comment field of the TempCommentEdit tiddly, but I can't find a way to pass the title of that originating tiddly to the TempCommentEdit tiddly, so I could use it in an updateComment button like:

<$button to="THIS IS THE BIT I CAN'T DO" set="THIS IS THE BIT I CAN'T DO!!comment" setTo {{!!comment}}>
Update Comment
</$button>

I'd be grateful for any help.

thanks 

Chris

Javier Eduardo Rojas Romero

unread,
Mar 26, 2021, 1:04:43 PM3/26/21
to tiddl...@googlegroups.com
Hello,

From what I know, you can't achieve what you want only with the
<$button> widget, and you'll have to use additional actions/widgets.

For setting fields of tiddlers, check the ActionSetFieldWidget:
https://tiddlywiki.com/#ActionSetFieldWidget

And for editing the text, check the EditTextWidget:
https://tiddlywiki.com/#EditTextWidget ; check the examples in this
page/tiddler, I think you'll find there an example really close to your
needs.

That said, I took a stab at building what (I think/I understood) you
want: adding a button that takes you to a place where you can edit the
"comment" field of the source tiddler.

First, the button definition for the bibtex tiddlers; it stores the
current tiddler in a field of the TempCommentEdit tiddler, and takes you
to that tiddler:

<$button>
<$action-setfield $tiddler="TempCommentEdit" commentSourceTiddler=<<currentTiddler>> />
<$action-navigate $to="TempCommentEdit"/>
edit
</$button>

And then, the contents for the TempCommentEdit tiddler: it has a text
field, that references the "comment" field of the tiddler referenced
from its "commentSourceTiddler":

<$edit-text tiddler={{!!commentSourceTiddler}} field="comment" tag="textarea"/>

Cheers,

On Sun, Mar 21, 2021 at 08:48:23PM -0700, cw wrote:
> I have imported some BibTeX references into TW. I have a field in the
> reference tiddly called "comment".
>
> I want to be able to edit that comment - and I understand that has to be
> done in another tiddly
>
> so the body of the reference tiddly:
>
> {{!!bibtex-title}}
> BibTeX key: {{!!title}}
> Status: {{!!status}}
> Comment:
> <hr>
> {{!!comment}}
> <hr>
>
> <$button to="TempCommentEdit" set="TempCommentEdit!!comment"
> setTo={{!!comment}}>
>
> Edit Comments
>
> </$button>
>
> That button goes to the target tiddly (TempCommentEdit") and sets its
> comment field to the originator's comment field, and I can edit it.
>
> I would like to be able to "do the reverse" and set the comment field of
> the "originator" tiddly to the edited comment field of the TempCommentEdit
> tiddly, but I can't find a way to pass the title of that *originating*
> tiddly to the TempCommentEdit tiddly, so I could use it in an updateComment
> button like:
>
> <$button to=*"THIS IS THE BIT I CAN'T DO*" set="T*HIS IS THE BIT I CAN'T DO*!!comment"
> setTo {{!!comment}}>
> Update Comment
> </$button>
>
> I'd be grateful for any help.
>
> thanks
>
> Chris
>
> --
> You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d7d480aa-ed68-4c1d-b0f2-8ff9fc901cdbn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages