how to set field value of tiddler in widget (javascript)

59 views
Skip to first unread message

p.ke...@everteam.com

unread,
Jul 4, 2018, 7:51:05 AM7/4/18
to TiddlyWiki
Hello,
I want to set field value from javascript function invoked in custom widget ...
I dont find any slot ...
Any tips ?
Thank you,
Philippe

Jed Carty

unread,
Jul 4, 2018, 8:22:15 AM7/4/18
to TiddlyWiki
The function you use is:

$tw.wiki.setText(tiddler, field, index, value, options);

where tiddler is the tiddler that has the field you want to change, field is the field you want to change, index is the index you want to change, value is the value you want set in that filed and I can never remember what options are available because I never use them.

If you give an index than it uses that instead of the field, if you are setting a field value set the index to null or undefined.

You can look at the action-setfield widget as an example https://tiddlywiki.com/#%24%3A%2Fcore%2Fmodules%2Fwidgets%2Faction-setfield.js

p.ke...@everteam.com

unread,
Jul 4, 2018, 8:41:19 AM7/4/18
to TiddlyWiki
Thank you for the reply.
But I dont understand what index is ?

Jed Carty

unread,
Jul 4, 2018, 8:44:20 AM7/4/18
to TiddlyWiki
Just set it as null or undefined. It is the same as in the action-setfield widget.



Reply all
Reply to author
Forward
0 new messages