Discuss: Prettier Accessible Forms
by Nick Rigby
- Editorial Comments
2 Untitled
Nick, great article and an important topic, since form-styling can be really difficult.
But your example (example_3) does not work in FF 1.5.0.4 (no extensions).
@Luc: I don’t think so, because if you want to or have to achieve a complex layout sometimes it’s the only way.
posted at 10:15 am on June 20, 2006 by Chris Leipold
3 JS not necessary
Luc is right – JavaScript for markup isn’t necessary here because you can work with float and margin to hav a table-ish form layout like that. The best example I know comes from Paul Armstrong and works great without any JS. Nevertheless, your article is really nice :)
posted at 10:40 am on June 20, 2006 by Christian Tietze
4 Re: JS not necessary
Christian, you are right. But I experienced massive problems if a floated form is inside other floats (in IE, naturally).
Regarding my other post (#2); I did not mention it’s FF/Win. FF/Mac does fine.
posted at 10:47 am on June 20, 2006 by Chris Leipold
5 Similiar layout with divs
I’ve created several comparable layouts in the past with just grouping the label and input control with a div and using floats.
The point I’m trying to make is that if you have to turn to scripting to display a relative simple static layout correct, you should automatically be triggered to find an alternative solution, because your problaby taking the wrong a path to a solution.
Quote frome Molly E. Holzschlag’s article “World Grows Small: Open Standards for the Global Web”
“Rely on JavaScript as an enhancement for, not a replacement of, website features.”
posted at 11:10 am on June 20, 2006 by Luc van Soest
6 Aside
Apart from the aforementioned issues with the JavaScript in use here, this seems like a solid solution for a practical problem.
I’ve been trying to figure out a good way to style up semantic forms, and this looks like a step in the right direction as far as I’m concerned.
Good article, and thanks for sharing.
posted at 11:13 am on June 20, 2006 by Damien Wilson
7
Thanks for all the comments so far.
I agree that JavaScript shouldn’t normally be used for styling, but in this scenario I broke a rule, but it offers an unobtrusive fix for a specific browser. The forms work with or without JavaScript/CSS enabled and the complete method offers a robost, accessible and portable solution to a common problem.
I’ve been using and testing this method for a fairly long time now, and in my experience it works incredibly well, so I hope someone else can find it useful.
@Chris Leipold: Which patform are you on? Firefox 1.5.0.4 is working ok for me.
Thanks again for all the comments.
posted at 11:24 am on June 20, 2006 by Nick Rigby
8 CSS off?
If I turn the CSS off, the example looks like rubbish. It looks a bit better in Lynx, but still not intuitive. For example the question “Which of the following sports do you enjoy?” has all the answers listed in one row – if it’s a list of answers, why not mark it up as list?
And whenever I see this “mandatory fields marked *” kind of thing, I think, why don’t they just add text “(mandatory)” or “(required)” after the field name?
BTW, the example is buggy: I see “null” written at the beginning of each field label (“nullName”, “nullAddress”, …).
posted at 11:32 am on June 20, 2006 by Rene Saarsoo
9 A side note
I want to mention, that despite the fact I partially don’t agree with the author’s vision, I do appreciate he took the time and effort to share his solution with the community. Don’t want to sound to negative, just keep on sharing your toughts _
posted at 11:38 am on June 20, 2006 by Luc van Soest
10 Untitled
Oh… those “null”-s I mentioned, they are generated by JavaScript. I’m using some weekly build of Opera 9, so it might be some bug in this build, but not very likely (works fine in FF and Konqueror).
posted at 11:39 am on June 20, 2006 by Rene Saarsoo
Discussion Closed
New comments are not being accepted, but you are welcome to explore what people said before we closed the door.
Got something to say?
Discuss this article. We reserve the right to delete flames, trolls, and wood nymphs.
Create a new account or sign in below if you’d like to leave a comment.
Subscribe to this article's comments: RSS (what’s this?)






1 Scripting for style?
I’m not a css-guru or something like that, but I think the habit to use scripting for styling, which I see more and more these days, isn’t a very good thing. I’m convinced that there are tons of other ways to create a similiar, semantically correct, layout. If you want to create a website that’s accesible in all browser and you want to use a css-property that isn’t supported you just shouldn’t use it.
posted at 10:07 am on June 20, 2006 by Luc van Soest