logo

Setting The Table

The humble table hey? Poor thing. It's almost become a byword for bad design. Why though? It's still as useful as ever though. Maybe it's not best used for layout of a page, but, when you're laying out data/forms, it's hard to beat a simple table.

Using CSS to layout a complicated form with lots of fields just isn't worth trying. If the intended use of tables is to display data, why can't it be used to show that data being edited? I still use them for layout of forms and have no qualms about it.

Recently I've been playing with use more CSS to govern the appearance of my tables. I've also started using the <caption> element to apply a "header" to each table. It's all very accessible and proper. Here's a simply of example of a table using a caption and some <col> elements.

Personal Information
Name:
Age: Sex: Male
Female
Bio:

Looks best in IE as Mozilla seems unable to process any styles applied using the COL tag. To see the HTML and CSS used look at the source of this page. Notice how lightweight the HTML is. No repeated attributes for any of the cells.

What I don't use are Notes tables. I don't need to tell you why. Instead, I create all mine in PassThru HTML. You then have complete control. It's amazing how powerful tables are. It's all documented at the W3C.

Next time you create a new form use your own HTML to create the table! It's might take a bit longer but it's much more fun/

Comments

  1. Actually I'm not sure what all the fuss is about with Notes Generated tables.

    OK, it you use the defaults then they do look awful. But you can tweak them.

    You can even insert Caption tags quite easily. That is what the "other" option in the HTML tags is for. Just make sure you mismatch the entries such as "><caption>Wibble</caption" (will this show correctly?) what this will do is close the table tag, insert the caption, and any extra Notes generated tags dtop onto the end of the close caption tag where they are totally ignored by all browsers.

    I much prefer working inside Notes Tables because you can actually see on the page exactly where everything should be.

    • avatar
    • Ag
    • Tue 7 Jun 2005 06:57

    @Dragon:

    Nice hack, but how do you do <thead>, <tbody> and <tfoot> ?

    In my experience, Notes tables are great for ... you guessed it ... Notes.

  2. I didn't say it was perfect. :)

    If you really want (need) all that extra stuff then use pass-thru HTML to lay it all out. I'm simply pointing out that getting rid of the standard Notes tables is not always better. Especially when you have a lot of stuff that needs laying out properly.

    Case in point, I recently did an application for a huge steel manufacturer, where their forms were all laid out using tables. (6 cols across, title-field-title-field-title-field, about 18 down quite a few with merged cells for wider entries ie. textareas etc.) There were quite a few hide-whens and such in there. You have re-written that in pure HTML would have been a real pain. But by using the additional tags, I used the Notes table on the form and managed to keep everything nicely laid out. If another developer comes in to change it, then they will be able to see exactly what goes where on the page.

    I'm all for making things simple. Both for myself and whoever has to maintain the apps. Dumping tables for the sake of it can often lead to other problems.

    • avatar
    • Jake Howlett
    • Tue 7 Jun 2005 07:10

    When I open a Domino Form to edit the HTML I like to see it laid out in front of me (the HTML that is). I don't want to have dig around in property boxes, guessing where it all might be.

    Using PT HTML means it's all there for you to see and easily edit.

  3. You know, with R6 you can do both - create your table with the Notes interface, then convert to HTML. If you then use the HTML preview pane, you can make changes to the HTML code and see the changes immediately. It's pretty convenient.

  4. Another great use of plain old HTML table tags in Domino is within views. An embedded view with a few markup columns for formatting can make a NotesView look like a nicely formatted table instead of one of those awful Notes rendered HTML views.

  5. Hi Rock,

    could you post 2 screenshots of the differences in Firefox and IE? I look at you above form in IE6 and FF104 and can't spot any?

    Could it be the local preview? (Notes doesn't spit out a complete Doctype so FF goes Quirx).

    :-) stw

  6. Ok. Your page is Quirx online too. So what could it be?

    • avatar
    • Jack
    • Tue 7 Jun 2005 10:31

    The field labels are gray text in ie6 and black text in FF.

  7. @Jack... And I'm getting color blind <g>.

    However one little quirk. Since you do passthru html, then you could/should (for accessibility sake) use [label for=...] for the labels. This conforms to accessibility guidelines and serves as an anchor for a style definition, so gray comes back in FF too. You could play with the width setting for the labels and eventually get label and field in one cell (but that's already optional).

    :-) stw

  8. I think Domino 7 is going to give us the ability to insert thead, when I remember right.

    I have no fixed preferences here. Depending on the complexity of the problem - or my actual level of lazyness - I use on or the other (pass-through vs. Domino generated). But I strongly back up Esters comment. Maybe just to often I forget about this one, althogh i'ts been there for almost 3 years now ...

  9. Just to know: what's so special about this caption tag? Why not use a <th> tags instead? Why is a caption better?

  10. A <th> is actually ment to be the header of one table column. I might be appropriate to spread it over more than one column, but strictly speaking it is an semantical abuse to spread it over all the columns.

    Also, the caption is not concidered a part of the table structure, but really just that, a caption. Of course, you can still apply some fancy formatting, as Jake did.

    • avatar
    • Ines
    • Thu 9 Jun 2005 06:00

    No need for a table in this context, I think...

    Why don't you just use the HTML-Tags created for forms, such as fieldset, legend and label?

    • avatar
    • Jake Howlett
    • Thu 9 Jun 2005 06:05

    You can do that Ines but the CSS to try and achieve the same layout is very tricky!

    • avatar
    • zomek
    • Fri 10 Jun 2005 04:15

    I was trying to investigate the differences in displaying by IE and Firefox (my favourite ;). Styling of COL element in Firefox is poor, that's true. But I noticed you have used some strange CSS definition of COL widths:

    width="20%";

    (exact copy of HTML COL element's attribute definition??). IE is guessing it right, but Firefox takes only (and works with):

    width:20%;

    Too little time to validate (HTML+CSS) this demo page? :-D

  11. I completely disagree with the statement "Using CSS to layout a complicated form with lots of fields just isn't worth trying." Currently I layout almost every hand coded HTML form using CSS, there are VERY few occasions where my example on Mikezilla {Link} cannot be reused almost effortlessly and the coding is FAR easier than hand coding HTML tables for the same result. The reason people believe that using CSS for form layout isn't worth while is because they don't do it on a regular basis. I do, not because I am an anal CSS geek but because it is genuinely easier once you have done it several times and are used to doing it.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Tue 7 Jun 2005

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

Elsewhere

Here are the external links posted on the same day.

More links are available in the archive »

More Content