On 7/16/07, MerlinTheCat <[EMAIL PROTECTED]> wrote:
>
> Hi, I'm well versed in JS - but I've been struggling to understand
> MochiKit for a couple of days... help from anyone who can clear my
> brainblock would be appreciated. Thanks.
>
> I'm trying to add a form on the page dynamically. The H1 and [object
> Object] form? gets displayed on the page... but I can't see the form
> or access any of it's fields or submit it???
>
> Here's my code:
>
>
> MochiKit.DOM.withWindow(self.window, MochiKit.Base.bind( function() {
>
>         var doc = MochiKit.DOM.currentDocument();
>         MochiKit.DOM.appendChildNodes(doc.body, H1(null,"This gets added
> OK"));
>
>         var formObj = MochiKit.DOM.FORM({"id":"myForm",
> "action":"test01.asp", "method":"post"}, {"inputs": [{"type":"text",
> "id":"field1", "name":"field1", "value":"newval"}, {"type":"submit",
> "name":"mySubmit", "value":"mySubmit"}]});
>
>         MochiKit.DOM.appendChildNodes(doc.body, formObj);
>
> alert(doc.body.formObj.field1);  // this indicates undefined?
> alert(doc.formObj.field1);  // this indicates undefined?
>
> }, this));

That's because the code you wrote doesn't make any sense. {"inputs": [
... ]} isn't going to do anything. You need to do the same thing
you're doing with FORM, except with INPUT.

FORM(attrs, INPUT(attrs), INPUT(attrs), ...)

-bob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to