I'm so happy - I figured it out (after reading Eric's 2007 reply more
carefully).

Anyway, for completion's sake, here's the code that works:

config.macros.newProblem={};
config.macros.newProblem.handler = function
(place,macroName,params,wikifier,paramString,tiddler)
{

        if (!readOnly)
                {
                clearMessage();
                var problemDescription = prompt("Enter Problem
Description-");
                var now = new Date();
                var formatedDate = now.formatString("YYYY-0MM-0DD");
                var newtitle = formatedDate + " " +
problemDescription;
                var newtext = "<<tiddler ProblemTemplate3 with: "+newtitle+">>"

                if (store.tiddlerExists(newtitle))
                        {
                        alert("A tiddler with that name already
exists!!!");
                        }
                else
                        {
                        story.displayTiddler
(null,newtitle,DEFAULT_EDIT_TEMPLATE);
                        story.setTiddlerTag(newtitle, "ProblemsList", 0);
                        story.getTiddlerField(newtitle,"text").value=newtext;
                        story.focusTiddler(newtitle,"title");
                        }
                }

 return false;

}





On Jul 20, 4:11 pm, cedardoc <[email protected]> wrote:
> okay, I've tried to solve my problem a different way.  I stole this
> code Brady wrote back in 
> 2007:http://groups.google.com/group/TiddlyWiki/browse_frm/thread/9f847c2df...
>
> and tweaked it like so:
>
> config.macros.newProblem={};
> config.macros.newProblem.handler = function
> (place,macroName,params,wikifier,paramString,tiddler)
> {
>
>         if (!readOnly)
>                 {
>                 clearMessage();
>                 var problemDescription = prompt("Enter Problem
> Description-");
>                 var now = new Date();
>                 var formatedDate = now.formatString("YYYY-0MM-0DD");
>                 var newtitle = formatedDate + " " +
> problemDescription;
>
>                 if (store.tiddlerExists(newtitle))
>                         {
>                         alert("A tiddler with that name already
> exists!!!");
>                         }
>                 else
>                         {
>                         story.displayTiddler
> (null,newtitle,DEFAULT_EDIT_TEMPLATE);
>                         story.setTiddlerTag(newtitle, "ProblemList", 0);
>                         story.setTiddlerText(newtitle, "<<tiddler 
> ProblemTemplate3 with:
> "+newtitle+">>", 0);
>                         story.focusTiddler(newtitle,"title");
>                         }
>                 }
>
>  return false;
>
> }
>
> But as soon as I add in that "story.setText" thing it breaks.  I've
> also tried it with:
> <<tiddler ProblemTemplate3 with: {{newtitle}}>>  but that doesn't work
> either
>
> any hints?  I think I'm mixing up my syntaxes, but I don't really
> know...
>
> Thanks,
> Dave
>
> On Jul 19, 11:55 pm, cedardoc <[email protected]> wrote:
>
> > thank you Eric.  I think that worked, but not the way I expected...
> > maybe you can see where I'm going wrong:
>
> > Template2 (using your ListboxPlugin) has this:
> > | Location:|<<select locat...@$1 rows:1 allowBlank
> > +BodyLocationTemplateTotal allowEdit>>|
>
> > and so the value returned by {{tiddler.title}} in the new tiddler is
> > supposed to be inserted at the "$1"
> > It works fine if I have a one-word title, but if I have a two word (or
> > more) title (e.g. "abcd efgh"), I get a table with
>
> > "Location:" in the left cell, but what looks like a list box with
> > (from top to bottom): (space), efgh, rows:1, allowBlank,
> > +BodyLocationTemplateTotal, allowEdit, other:foot.
>
> > Any ideas?
>
> > p.s.:  I'd almost rather be able to somehow replace
> > "{{tiddler.title}}" in the body of the newly formed tiddler with the
> > actual text of the title itself - is that at all possible (without
> > having to write a new plugin or something drastic like that)?
> > (because I'd like to see the contents of the new tiddler in a pop-up
> > which does work if the tiddler title is actually in the <<tiddler>>
> > macro)
>
> > On Jul 19, 10:57 pm, Eric Shulman <[email protected]> wrote:
>
> > > > <<tiddler ProblemTemplate2 with: "{{tiddler.title}}">>
> > > > but that doesn't work either
>
> > > You were close... just remove the excess quotes:
> > >    <<tiddler ProblemTemplate2 with: {{tiddler.title}}>>
>
> > > enjoy,
> > > -e
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to