Templates, pre tagging and default texts

120 views
Skip to first unread message

Ste Wilson

unread,
Jul 12, 2018, 8:06:11 AM7/12/18
to TiddlyWiki
Thanks to the ever amazing Jed I have cannibalised the New Tiddler Form from inmysocks. (thanks Jed)

I'm sure the answers are out here somewhere but...

I would like the created tiddler to have a default set of tags.
I also need the created tiddler to have a couple of templates referenced in them at the bottom of the tiddler, ideally the user dosn't see the text for these in the form.

Further out I would like to be able to select one of three form which have an overlap of fields depending on what needs entering (Equation, Variable, Constant) and have the form react accordingly.


Thanks in advance.

Ste

 

Ste Wilson

unread,
Jul 22, 2018, 7:06:43 AM7/22/18
to TiddlyWiki
I'm using the following to 

<$button>Create Tiddler
<$action-setfield $tiddler={{$:/state/NewTiddlerForm!!name_temp}} 
text={{$:/state/NewTiddlerForm!!text}}
description={{$:/state/NewTiddlerForm!!description}} 
equation={{$:/state/NewTiddlerForm!!equation}} 
tags={{$:/state/NewTiddlerForm!!tags}}/>

<$action-navigate $to={{$:/state/NewTiddlerForm!!name_temp}}/>
<$action-setfield $tiddler='$:/state/NewTiddlerForm' name_temp='' text='' description='' tags=''/>
</$button>

to create a new tiddler with pre-filled in details, however, I ALSO need 

{{||$:/template : equation}}

{{||$:/template : variable}}

to be placed at the end of any text in the text field.

All I've managed to do so far is overwrite any previous text with the {{||$:/template : equation}} bit :(


Jed Carty

unread,
Jul 22, 2018, 7:24:42 AM7/22/18
to TiddlyWiki
I believe that the addsuffix filter is what you are asking for here, but I believe that a better solution is a view template.

Using addsuffix:

put the suffix you want added to the text into a tiddler called 'Suffix Tiddler' and then use this:

<$button>Create Tiddler
<$set name=fullText filter='[{$:/state/NewTiddlerForm!!text}addsuffix{Suffix Tiddler}]'>
<$action-setfield $tiddler={{$:/state/NewTiddlerForm!!name_temp}}
text=<
<fullText>>

description={{$:/state/NewTiddlerForm!!description}}
equation={{$:/state/NewTiddlerForm!!equation}}

tags={{$:/state/NewTiddlerForm!!tags}}/>

<$action-navigate $to={{$:/state/NewTiddlerForm!!name_temp}}/>
<$action-setfield $tiddler='$:/state/NewTiddlerForm' name_temp='' text='' description='' tags=''/>
</$set>
</$button>

to use a view template make a tiddler named whatever you want and give it the tag $:/tags/ViewTemplate and put this inside it. Change someTag to whatever tag you put give the tiddlers.

<$list filter='[is[current]tag[someTag]]'>

{{||$:/template : equation}}

{{||$:/template : variable}}
</$list>


Ste Wilson

unread,
Jul 22, 2018, 12:03:31 PM7/22/18
to TiddlyWiki
Cheers Jed,
The suffix solution seems to leave some square brackets hanging around.

The other solution... OMG.... why have I not worked this out before! Tiddlywiki is amazing!

Thank you.

Stephen

Reply all
Reply to author
Forward
0 new messages