Hi Jeremy,

It's been some time but I've finally found time to continue this effort 
with TW5.1.11.  (Love the tiddler folding)  I've removed the previous 
"default" idea from the checkbox (and an equivalent radio) rule and moving 
forward.  I'm assuming one can "initialize" the tiddler defaults by setting 
tiddler field *values *"manually" when creating the tiddlers containing 
multiple checkboxes only or radios only.

This turned into a new problem for both the checkbox rule (similar to that 
shown previously) and radio rule.

The checkbox rule needs to wikifyPlain() (TWC term) and remove/change 
invalid chars for the corresponding tiddler field -- value set to 
true/false.  In addition, I would like the radio rule to wikifyPlain() the 
radio label to provide the *value *of a *static *field name.

Is there a TW5 method I can use to provide the equivalent of wikifyPlain() 
in a TW5 rule?

The overall implementation effort is attempting to allow an end-user (new 
TW5 user) to create the "questions" (using checkbox/radio rules rather than 
the *more cryptic* widget syntax).  User will then process the wiki's 
"wikifyPlain()" fields/values as needed.

Hope this makes sense.  Thanks for yours or anyone's thoughts.
PS. Is there an easy way to enable folding on a tiddler being edited?

On Thursday, April 23, 2015 at 6:54:51 PM UTC-5, senechaux wrote:
>
> Hi Guys,
>
> Not sure if this is possible but found it creating the checkbox with some 
> gotchas.
> /*\
> title: $:/core/modules/parsers/wikiparser/rules/checkboxrule.js
> type: application/javascript
> module-type: wikirule
> \*/
> (function(){
>
>   /*jslint node: true, browser: true */
>   /*global $tw: false */
>   "use strict";
>
>   exports.name = "checkboxrule";
>   exports.types = {inline: true};
>
>   exports.init = function(parser) {
>     this.parser = parser;
>     // Regexp to match
>     this.matchRegExp = /\[([xX_ ])\] ?(.*)/mg;
>   };
>
>   exports.parse = function() {
>     this.parser.pos = this.matchRegExp.lastIndex;
>     var checked = ($tw.utils.trim(this.match[1]).toUpperCase()=="X");
>     var lbl = $tw.utils.trim(this.match[2]);
>     return [{type: "checkbox", 
>         tag: "$checkbox", 
>         attributes: {
>             id            : {type: "string", value: "AM_"+lbl},
>             field        : {type: "string", value: lbl},
>             checked        : {type: "string", value: true},
>             unchecked    : {type: "string", value: false},
>             default        : {type: "string", value: checked}
>         },
>         children: [{
>             type: "text", 
>             text: " "+lbl
>         }]
>     },
>     {type: "element", tag: "br"}
>     ];
> };
> })();
> The use of a default appears to cause problems (a 3rd state appears where 
> 'checked' but field shows false) and the label doesn't get wikified.  Am I 
> going about this the wrong way or is this a valid rule?
>
> Thanks for your thoughts.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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 https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/23594387-dab5-4971-8b31-56e142511a60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to