2

I am wondering if there is a way to create a Drupal form on the fly with javascript? I know I can create a form, but how could I create all the Drupal hidden fields and other required pieces?

Or if this is even possible?

6
  • Possible, yes (though messy) but what problem are you trying to solve that loading in a form via AJAX wouldn't?
    – Clive
    Commented May 26, 2014 at 10:57
  • How can I load the form via Ajax?
    – Steven
    Commented May 26, 2014 at 11:19
  • drupal.stackexchange.com/questions/9961/…
    – Clive
    Commented May 26, 2014 at 11:23
  • @Clive while that question covers outputting the HTML for the form, there seems a lot of functionality missing. I'm trying to do this and I get the form, but not the behaviors, e.g. the autocomplete tag field is not autocompleting. Commented Jun 12, 2014 at 11:19
  • @artfulrobot Just call Drupal.attachBehaviors() after the AJAX call - problem solved
    – Clive
    Commented Jun 12, 2014 at 11:22

0

Browse other questions tagged or ask your own question.