[drupal-devel] [bug] form_hidden and form_submit generate invalid XML

Steven drupal-devel at drupal.org
Tue Jan 18 22:31:20 UTC 2005


 Project:      Drupal
 Version:      4.5.2
 Component:    base system
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Kjartan
 Updated by:   Steven
 Status:       patch

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.


Steven



Previous comments:
------------------------------------------------------------------------

September 2, 2003 - 11:58 : Kjartan

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.

------------------------------------------------------------------------

September 4, 2003 - 20:58 : ax

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 [1]
("PROBLEM 2: common.inc form_* functions")
[2] Re: [drupal-devel] form_* functions |
http://lists.drupal.org/archives/drupal-devel/2002-10/msg00676.html [2]
[1] http://lists.drupal.org/archives/drupal-devel/2003-06/msg00172.html
[2] http://lists.drupal.org/archives/drupal-devel/2002-10/msg00676.html


------------------------------------------------------------------------

January 18, 2005 - 18:08 : Zed Pobre

Attachment: http://drupal.org/files/issues/common.diff (600 bytes)

Attached is a patch to add  encapsulation to the form_hidden and
form_submit functions in common.inc.


------------------------------------------------------------------------

January 18, 2005 - 18:39 : tangent

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.


-- 
View: http://drupal.org/node/2714
Edit: http://drupal.org/project/comments/add/2714





More information about the drupal-devel mailing list