Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

closed as too broad by Mołot, Free Radical, kiamlaluno Jul 9 at 8:35

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Possible, yes (though messy) but what problem are you trying to solve that loading in a form via AJAX wouldn't? –  Clive May 26 at 10:57
    
How can I load the form via Ajax? –  Steven May 26 at 11:19
    
    
@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. –  artfulrobot Jun 12 at 11:19
    
@artfulrobot Just call Drupal.attachBehaviors() after the AJAX call - problem solved –  Clive Jun 12 at 11:22

Browse other questions tagged or ask your own question.