I have a complex form that was developed using jQuery that is exactly the way I want it. I have been reading and researching for weeks now and it seems the only way to get a form into Drupal is to start over and declare each element in an array. I have already started writing a module for it and created the schema (it requires 9 tables and hundreds of columns). There are places where the user will need to add an additional entry like the previous one (in reality adding another row to a table). I can easily code all this in HTML and jQuery but am absolutely stumped about bringing this into Drupal without writing out hundreds of lines of code to define elements that are already defined in my form.

Also, although I see that you can add jQuery to your modules and its simply a matter of a simple call to add in your script - I don't see how to add jQuery in forms.

Is there a way to write a theme override and simply load my form into a $content variable?

Also, the user needs to be able to save the form without technically submitting it (I thought of using workflow for this) but when they return, the values they have entered must (obviously) be populated. (Which is one reason I can't just use Webform) Can I simply call the values from the database using php or do I have to use Drupal functions? All we really want from Drupal as far as this particular form is concerned is permissions management and the ability to save a draft before actually submitting the form.

Yes, I read the Theme API, the creating modules documentation, several third party books and nothing has answered this. Any help from this great community would be appreciated.

Comments

rimian’s picture

If your form is very complex, you should consider if this form is a candidate for the Form API of should you write something that doesn't use the API at all.

I spent way too much time doing this once and learned the hard way: There are rare cases where the API just isn't the right tool for the job. Having said that, the Drupal Form API is a very well written bit of software.

Of course you'd have to handle the security etc yourself.