By ardee-1 on
If you create a Drupal Form (see http://api.drupal.org/api/4.7/file/developer/topics/forms_api.html), the resulting form puts every form element within its own DIV (and thus only "below" the preceding one).
Is there a way to turn off having every element go into its own DIV? (I'm a site developer, not a module developer, if that matters.)
Just want to make a form look more like a table, with some elements arranged horizontally.
Thanks for any advice on this!
[Specifics: I want a "table" of recent nodes, with each "row" showing these node fields: nid, title, created date, modified date, link to edit page. Titles & dates should be editable.]
Comments
A few approaches to what you want
You could try and use CSS to achieve the look you are after.
You could override the appropriate theme function(s) so the divs are not output but this would impact all existing forms also
What I do in cases like this is theme the form so the elements are placed in a table.
Got it working, but...
If by "theme the form" you mean to insert
'#type' => 'markup'elements for the<table>, </table>, <thead>, </thead>, <th>, </th>, <tbody>, </tbody>(and#prefixand#suffixproperties for each<tr>, </tr>, <td>, </td>), then I'm all set. I got it working.If you meant something else, then I'm still not clear.
That is one way
While not what I meant it is one way to do it. In Drupal it is also possible to write a theme function that in this case would place the elements inside of a table.
Well...
I believe you, but would need a bit more detail to know what you're referring to.
(Where do you write the function? How do you name it? How/when does it get called? How does this avoid the DIVs? Where is this documented?)
One div, mutiple items
Hello!
I came across this looking for a way to use CSS styles to encapsulate an entire table as a single element.
The table in question is static and used only to hold other data.
What i would like to do is have
be all i need to encapsulate something inside.
As it stands i have
Is what i'm thinking of possible? A style entry called table.container with tr and td assets listed in the style sheet?
Thanks much!
-Alex
Update: I found this link that does what i believe we're looking for, but not with any current version of IE. Is there a way to do this with Drupal, such that it is supported by IE?