I completely agree that htmlify is a hack that really doesn't reduce code. At the time I wrote it, I needed a fix for a few forms. I'll probably wind up removing it or changing it to something cleaner. Maybe when I learn about DOM objects as FND suggested.
Your solution is elegant. As I have no DOM knowledge, your use of the options method really cleans things up. I guess I'm going to look for a DOM book tonight. I am toying with the code you just posted in a clean wiki and finding it doubles the results in the dropdown list. It seems that this line is the culprit: list.options[list.length]=new Option(tids[i].title,tids[i].title); I changed it to this and it works much better: list.options[i]=new Option(tids[i].title,tids[i].title); Thanks for your insight! On Wed, Nov 4, 2009 at 11:55 AM, Eric Shulman <[email protected]> wrote: > >> So I wrote my solution as a new macro selectfromlist creating my >> dropdownlist from items of a particular tag. > > Here's a non-plugin TW-native syntax for definining and filling an > HTML 'select list' element... > > First, create a tiddler, e.g., [[MakeList]], containing: > > <html><select name="$1" size=1></select></html><<tiddler {{ > var list=place.lastChild.firstChild; > var tids=store.getTaggedTiddlers("$2"); > for(var i=0;i<tids.length; i++) > list.options[list.length]=new Option(tids[i].title,tids > [i].title); > "";}}>> > > Note use of "$1" and "$2"... these are 'substitution markers' used to > insert parameter values when 'transcluding' this tiddler into another > via the <<tiddler>> macro, like this: > <<tiddler MakeList with: "listname" "tagvalue">> > > Also, it doesn't seem that <<htmlify>> is really needed. It doesn't > really make the syntax any cleaner, and is actually a few bytes longer > than using regular TW syntax to embed the HTML block directly. > Compare: > <<htmlify '<input name=faction type=text />' >> > vs > <html><input name=faction type=text /></html> > > Thus, using the MakeList transclusion and HTML syntax above, you could > write the following to produce your desired results: > ------------------- > |Faction: |<html><input name=faction type=text /></html>| > |Morph: |<<tiddler MakeList with: morph Morph>>| > ------------------- > > enjoy, > -e > Eric Shulman > TiddlyTools / ELS Design Studios > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

