? Add a class to the wrapper div of form elements theme_form():
?   http://drupal.org/node/495480
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.445
diff -u -p -r1.445 form.inc
--- includes/form.inc	26 Mar 2010 18:58:12 -0000	1.445
+++ includes/form.inc	28 Mar 2010 23:31:32 -0000
@@ -2428,7 +2428,7 @@ function form_process_container($element
  */
 function theme_container($variables) {
   $element = $variables['element'];
-  if (!isset($element['#attributes']['id'])) {
+  if (!isset($element['#attributes']['id']) && isset($element['#id'])) {
     $element['#attributes']['id'] = $element['#id'];
   }
   // Force the 'form-wrapper' class.
@@ -2855,9 +2855,36 @@ function theme_textfield($variables) {
  */
 function theme_form($variables) {
   $element = $variables['element'];
+
+  // Provide both the form ID and the method.
+  $element['#attributes']['id'] = $element['#id'];
+  $element['#attributes']['method'] = $element['#method'];
+
+  // Inject the action only if one is given.
+  if (isset($element['#action'])) {
+    $element['#attributes']['action'] = check_url($element['#action']);
+  }
+
+  // Allow overriding of the accept-charset if desired.
+  if (!isset($element['#attributes']['accept-charset'])) {
+    $element['#attributes']['accept-charset'] = 'UTF-8';
+  }
+
   // Anonymous div to satisfy XHTML compliance.
-  $action = $element['#action'] ? 'action="' . check_url($element['#action']) . '" ' : '';
-  return '<form ' . $action . ' accept-charset="UTF-8" method="' . $element['#method'] . '" id="' . $element['#id'] . '"' . drupal_attributes($element['#attributes']) . ">\n<div>" . $element['#children'] . "\n</div></form>\n";
+  $children = theme('container', array(
+    'element' => array(
+      '#children' => $element['#children'],
+    ),
+  ));
+
+  // Construct the entire form tag.
+  return theme('html_tag', array(
+    'element' => array(
+      '#tag' => 'form',
+      '#attributes' => $element['#attributes'],
+      '#value' => $children,
+    ),
+  ));
 }
 
 /**
