I don't think that the filter in your reset macro does anything. The set
widget doesn't do anything permanent, it creates variables that exist only
inside the set widget in which they are defined. The action-setfield widget
is the one that actually changes stored values. With that said, you are
missing a </$set> and have one \define too many in the reset macro. To
reset only the text field all you need is the button you made.
\define reset(label,field,value)
<$button set="$:/temp/$label$!!$field$" setTo="$value$">Reset</$button>
\end
Also there is a $ missing in the macrocall, but I am assuing that is
intentional to keep it from rendering.
I think with the filter you are trying to iterate through all the fields in
the tiddler and clear all of them. Unfortunately tiddlywiki doesn't have
that ability yet, it is planned for sometime in the future but for the
moment I don't think anyone has found a way to set an arbitrary number of
fields using a filter like that.
If each one of your tick sheets is going to have the same fields that need
to be cleared you could use something like this:
\define reset(label)
<$tiddler tiddler='$:/temp/$label$'>
<$button>Reset
<$action-setfield text='' something=''/>
</$tiddler>
\end
And then << reset {{!!title}} >> would reset the text and something field
of the data tiddler associated with the current tiddler. It is nowhere near
as elegant as being able to iterate over a list, but another option would
be to have an empty tiddler that you rename and give the same name as the
storage tiddler you want to reset. So:
\define reset(label)
<$button>Reset
<$action-setfield $tiddler='$:/temp/BlankTickSheet' $field='title'
$value='$:/temp/$label$'/>
</$button>
\end
That will just overwrite the stored data with the tiddler
$:/temp/BlankTickSheet, and due to the order of operations taken by the
core it won't actually remove the tiddler $:/temp/BlankTickSheet, so if you
make your base (empty) tick sheet data tiddler and call it
$:/temp/BlankTickSheet (or whatever you want to call it) than the reset
button will effectively reset tiddler that stores the data for the current
tick sheet. This has the benefit of working when there are an arbitarry
number of fields, and if you add fields between resets.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.