You can use a dedicated theme function (not a template) to customize a form. An example is from Drupal core is the theme_menu_overview_form()
function. This function is used to theme the menu_overview_form
form and is registered as theme function in menu_theme()
.
The function build the variables used to call the table theme function (ie. theme('table', $variables));
). It render the selected form element inside the rows (using drupal_render()
). After renderign the table itself, the remaining form elements are appended, this include the submit button. Off course, you can also output some form element (or complete fieldsets) before the table.