Hi, all --

I've got a tiddler that I use to count characters.  Nothing fancy --
it's just an HTML form wrapped with some script that counts and
displays the chacters pasted into the textarea.

In getting ready to share it with someone else, I decided to move the
scripts to a plugin and make the form available with a macro call to
<<characterCounter>>.  (The idea is that anyone can install the plugin
and then paste in <<characterCounter>> wherever they want to see it,
rather than having to look at my clunky code when they click "edit" in
a tiddler.)

I think I'm on the right path, but this is the first time I've ever
used createTiddlyElement (or done anything DOM-related in
TiddlyWiki).  The plugin works fine (if I paste my form into a tiddler
and call the functions defined in it), but I keep getting macro errors
when I place <<characterCounter>> into a tiddler.

Can anyone show me what I'm doing wrong?

Here's the macro portion of the plugin, which appears below all the JS
function defintions:

/***
!Macro
***/
//{{{
config.macros.characterCounter = {}
config.macros.characterCounter.handler =
function(place,macroName,params,wikifier,paramString,tiddler) {
   var rowsHeight = "6";
   var colsWidth = "50";
   var characterCounterFormOutput = "<html>\n  <form method=\"POST\"
action=\"#\">\n    <table border=\"0\" cellspacing=\"0\" cellpadding=
\"0\">\n      <tr>\n        <td colspan=\"2\" align=\"right\"><input
type=\"reset\" onClick=\"simpleCount(\'fieldToCount\',
\'characterCountDisplay\',\'{CHARACTERCOUNT}\');\"></td>\n      </tr>
\n      <tr>\n        <td colspan=\"2\"><textarea id=\"fieldToCount\"
name=\"characterCounterInputField\" rows=\"" + rowsHeight + "\" cols=
\"" + colsWidth + "\" wrap=\"virtual\" onKeyUp=
\"simpleCount(\'fieldToCount\',\'characterCountDisplay\',
\'{CHARACTERCOUNT}\');\"></textarea></td>\n      </tr>\n      <tr>
\n        <td align=\"right\"><span id=\"characterCountDisplay\">0</
span></td><td> characters total.</td>\n      </tr>\n    </table>\n  </
form>\n</html>";
 
createTiddlyElement(place,div,null,CharacterCounter,characterCounterFormOutput);
}
//}}}

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlyw...@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to