On 10/25/06, Kevin Damm <[EMAIL PROTECTED]> wrote:
>
> There isn't a form module.  But, what you're looking for can probably
> be done using some MochiKit.DOM magic:
>
> var MyDic = [{'value':1, 'text':Text1}, {'value':2, 'text':Text2}];
> var sel = SELECT({});
> for (var i in MyDic)
> {
>   sel.appendChild(MochiKit.DOM.OPTION({'value': MyDic[i].value},
> MyDic[i].text));
> }
>
> Then just append the DOM node sel to wherever you want it in the
> document.  Also don't forget to include DOM.js, Iter.js, and Base.js
> for this code.
>
> I don't know if there's a better way to do it -- maybe someone else on
> the list knows a way to apply an array of OPTION nodes to the end of
> the select without the explicit for loop, maybe then you could use
> appendChildren.
>
> Bob - I had to use the full name of OPTION to get this to work; is
> there a reason why SELECT is in the global namespace but OPTION is
> not?  I started looking through the source for MochiKit.DOM but
> haven't narrowed down why this is the case.

Both are global, and it's been that way for a long time.

-bob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" 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/mochikit
-~----------~----~----~----~------~----~------~--~---

Reply via email to