Depending on the attributes of a tiddler, I want to do several things when I finish editing it. I achieve all such actions through a $:/MyDoneActions tiddler tagged as System. It is called from the save-tiddler-actions() macro in $:/core/ui/EditTemplate like this:
The problem is that even for tiddlers with less than 50 words, ‘small’ is not added to the field ‘atts’. At the same time, for tiddlers with non-blank ‘p1-date’, ‘rep’ is added to the ‘related’ field.
How do I get TW to add the appropriate value to the ‘att’ field? Is there something wrong with the way I am computing the wordcount? May be some syntax error?
The current tiddler when you edit it is not the same as the current tiddler when it is saved, but instead it is a tiddler named something like Draft of 'foo'so maybe you need to extract the actual name string.
But, just running things in a listwidget doesn’t execute such actions, at least not from the text field. As far as I know, you would need to somehow execute this in the Save tiddler button.
And it works as expected. That is when I complete editing of any tiddler that has a non-blank p1-date field, value of ‘rep’ is added to the field ‘related’.
Also, the $:/MyDoneActions is executed from save-tiddler-actions() in $:/core/ui/EditTemplate.
I should have put this information in my question for all to see. I am doing it now.
@TW_Tones Thanks. I have added more information to the question. That hopefully answers your point. Please let me know if you need more information.
Your point is well-taken. Word count can be computed on the fly and need not be stored. But I am making changes to the value of a field based on word count.