Custom field question

87 views
Skip to first unread message

axelm

unread,
Dec 29, 2011, 6:53:51 PM12/29/11
to tiddl...@googlegroups.com
Is there a way to do this:

If a field contains a certain value, that a tag is added to the tiddler automatically?

axelm


PMario

unread,
Dec 30, 2011, 2:22:07 AM12/30/11
to TiddlyWiki
Isn't it possible, to create the tags and the field together?

When should the tag be created?
eg: you have 3 tiddlers with a field and no tags
- Should there be a button, which iterates all tiddlers and add tags
- ...

-m

axelm

unread,
Dec 30, 2011, 12:38:08 PM12/30/11
to tiddl...@googlegroups.com
I have a plugin (ToDoPlugin) that creates a field called "tdptask0", but only when there is a ToDo item.
What I would like to have is that at the same time a tag would be attached to the tiddler.

axelm


axelm

unread,
Dec 30, 2011, 2:21:42 PM12/30/11
to tiddl...@googlegroups.com
Maybe, is there a script that can run when you close the tiddler?
The script could then check if the field is NOT empty and add the tag?

axelm

Eric Shulman

unread,
Dec 30, 2011, 2:45:43 PM12/30/11
to TiddlyWiki
If the plugin code is already adding a field to the tiddler, it would
seem relatively straightforward to modify the plugin to also tag that
tiddler at the same time.

Assuming you start with just a tiddler title, you need to get the
tidder object (if not already done by the plugin code), add a tag to
that object's 'tags' array, and save it back to the store:
var title="SomeTiddler";
var tid=store.getTiddler(title);
tid.tags.pushUnique("someTag");
store.saveTiddler(tid.title,tid.title,tid.text,tid.modifier,new
Date(),tid.tags,tid.fields);

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

----
TiddlyTools needs YOUR financial support...
Help ME to continue to help YOU...
make a generous donation today:
http://www.TiddlyTools.com/#Donations

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact



>
> axelm

axelm

unread,
Dec 30, 2011, 3:01:28 PM12/30/11
to tiddl...@googlegroups.com
Oh that sounds exactly like what I need.
But I have no idea how to "modify" a plugin.
Where would I add this code?

This is the plugin that adds the "tdptask0" field:

http://kronenpj.tiddlyspot.com/#ToDoPlugin

so close...

axelm

Reply all
Reply to author
Forward
0 new messages