I thought I replied to this yesterday. Well that's consistent with the rest of the day I was having, I guess. Anyway:
I tried MktoForms2.getForm() before posting. Didn't work. It got a Form Object, as described in the docs, but apparently that's not the same as a Form Descriptor object, because when I fed the received Form Object into MktoForms2.newForm() it died with a TypeError inside the minimized Marketo js file. But even had it worked, .getForm() requires the Form object to have already been created before it gets it. I was looking for a way to create the Marketo Form Object before rendering the form itself, hopefully completely stopping it from rendering until and unless necessary.
But thanks for the pointer to the REST API. I've wandered around in there before, looking for something else, but I remember there are several JSON structures in there, so perhaps I can hack together something based on one of those that will work. If not I'll probably have to fall back on a .loadForm() call; it'll work for me, after a fashion, but if I could get newForm() to work the way the docs let me think it works, it'll be cleaner.
(Context: I'm trying to pull multiple forms, then show a particular one after a user's action. It's cleaner if I have them all in hand, just waiting to be rendered. The best alternative I've found involves rendering *all* of them as hidden, then moving and/or revealing them after user action dictates which form should appear. It works, and yields a faster apparent response time than waiting to load the form until after the user acts, but it seems like it would be still faster and feels cleaner to me if I only render the one I need to render. I won't know if there's an actual speed gain until I'm able to test both approaches, hence this. IOW, I have two ways that work in front of me and I'm looking for a better way. Yes, as a matter of fact I *am* fussy, why do you ask?)