2
votes

I have mastered creating custom data types and adding fields with CCK. Then I created and deployed a custom module with _form and _validate and _submit hooks.

I am not happy with the amount of massaging required with css and permissions to make the form usable, but this is not my question.

Now I would like to create a more sophisticated form with jquery to submit form and add content to page. I am at a bit of loss as how to get to this next level. I have been looking at tpl.php files, but this looks very rigid and more complicated as well. Can any provide a model or tutorial or point me in right direction.

2

2 Answers

1
votes

If you want to customize how Drupal outputs your form, you have a few options.

  1. You can add some markup with the #prefix and #suffix attributes. You can also create form elements that is just markup if you need it.
  2. If you need more control over the form, you can create your own theme function for the form, or override the existing one with the #theme form attribute. In your theme function you have free hands to create more or less any markup you like. You might need to override some of the default theme functions that is used to render the form items.
0
votes

Will the ajax module do what you want?

CSS massaging is not usually needed, unless you're doing unusual custom stuff, and in that case it's not really massaging, it's adding custom CSS for your custom stuff. Might be a good idea to post a question on that topic, or do some digging on drupal.org. In other words you might be Doing It Wrong :)