form_submit() and form_hidden() don't wrap their output in a div or similar block element, this creates problems when trying to validate XHTML strict. Wrapping the return in a form_item(0, ....) seems to work fine.

CommentFileSizeAuthor
#2 common.diff600 bytesZed Pobre

Comments

ax’s picture

i think it is consensus that form_* functions shouldn't be wrapped into form_item() [1,2]. your problem would be much better fixed by adding an inner <div> to the form() function, ie.

function form($form, ...) {
  // ...
  return '
<form action=...>
  <div>
    $form
  </div>
</form>';
}

[1] Re: [drupal-devel] XHTML validity, part II | http://lists.drupal.org/archives/drupal-devel/2003-06/msg00172.html ("PROBLEM 2: common.inc form_* functions")

[2] Re: [drupal-devel] form_* functions | http://lists.drupal.org/archives/drupal-devel/2002-10/msg00676.html

Zed Pobre’s picture

StatusFileSize
new600 bytes

Attached is a patch to add

encapsulation to the form_hidden and form_submit functions in common.inc.
tangent’s picture

The previous attached file is not a good solution. The div ID must be unique so a class should be used instead.

If you submit a patch, use the unified option.

Steven’s picture

We typically use dashes to separate css id's and classes rather than underscores. Also, the usage of id's is invalid as has been said already.

However, I feel that form_hidden and form_submit is not the place to modify this, as wrapping the buttons in a div means that every one of them occupies its own line (and no, setting the div to inline display is not a good work around). This is bad for forms with multiple buttons (like the node submission form). Instead, we should find a solution that still allows for multiple buttons, preferably wrapped inside only one div per button set.

killes@www.drop.org’s picture

Steven didn't like it == zero chance for commit.

killes@www.drop.org’s picture

Is this still an issue in cvs with the new forms?

chx’s picture

Status: Active » Fixed

http://validator.w3.org/check?uri=http%3A%2F%2Fdrupal.org only comes up with the well-known wbr non-issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)