I don't think that's the problem.  The actual complete function is this:

  function tiddlerOfThis (element) {
    return 
(store.getTiddler(story.findContainingTiddler(element).getAttribute("tiddler")));
  }

since that function gets called like so:

  <input name=reschedule type=button value="reschedule" 
onClick="reschedule(tiddlerOfThis(this))" />

I was trying to make a minimal test case of sorts, by swapping in "this" where 
it would end up.

I've tried substituting in different code in the onClick handler; all the 
following work, whether they're called by pressing the button on the 
formTemplate itself or pressing it on a tiddler that uses the <<formTiddler 
...>> macro to use the formTemplate.

  alert("test! test!");
  alert(this.toString());
  alert(tiddlerOfThis(this).toString());
  alert(tiddlerOfThis(this).title.toString());

The following works on a derived tiddler, but not on the template tiddler:

  alert(tiddlerOfThis(this).data('alertDate').toString());

so does this:

  incDate(tiddlerOfThis(this).data('alertDate').toString());

where "incDate" is a function that doesn't actually do anything with the 
argument it receives (I have changed a LOT of things around, trying to figure 
out what's going on; here is the current code):

  function incDate (dateStr) {
    var myDate = new Date();
    myDate.setDate(myDate.getDate() + 1);
    alert(myDate.toString());
  }

It *seems like* I could get the effect I need by writing an onClick handler 
like the following:

  onclick="tiddlerOfThis(this).setData('alertDate', calculatedValue(....));"

where of course calculatedValue() figures out what the new date value should 
be, based on the values that are passed to it.  But in addition to wanting to 
*understand* what I'm doing, it seems to me like splitting up a calculation 
that only gets performed in one context into two pieces is ugly, and to be 
avoided if possible.

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to