469,323 Members | 1,522 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

<form> in 4.01 Strict

At <http://snow.prohosting.com/srcopan/src/search.html> I have a simple
form, using the following code provided by my site search provider:

<form method="get" action="http://search.atomz.com/search/">
<input size="20" name="sp-q"><br>
<input type="submit" value="Search">
<input type="hidden" name="sp-a" value="sp06251400">
<input type="hidden" name="sp-p" value="any">
<input type="hidden" name="sp-f" value="ISO-8859-1">
</form>

This code validates as 4.01 Transitional but fails as Strict due to the
use of <input>, <button> being the prefered element in Strict. Fine, but I
can´t for the life of me figure out how to rewrite this code using
<button> instead of <input>, even after studying the examples in the HTML
4.0 Reference and googling. In fact, googling leaves me with the
impression that most folks don´t bother to validate their form
submission code, but my momma didn´t raise me that way.

So, can anyone point me to something that will help me rewrite this code
to validate at 4.01 Strict?

TIA,
--
Warren Post
Santa Rosa de Copán, Honduras
http://srcopan.vze.com/
Aug 1 '05 #1
9 1872
"Warren Post" wrote:
This code validates as 4.01 Transitional but fails as Strict due to the
use of <input>, <button> being the prefered element in Strict.


What gave you that impression? The DTD says a FORM element can contain block
elements and scripts. INPUT isn't a block element. That's why your form
doesn't validate.

Try this:

<form method="get" action="http://search.atomz.com/search/">
<p><input size="20" name="sp-q"><br>
<input type="submit" value="Search">
<input type="hidden" name="sp-a" value="sp06251400">
<input type="hidden" name="sp-p" value="any">
<input type="hidden" name="sp-f" value="ISO-8859-1"></p>
</form>
--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
Aug 1 '05 #2
Warren Post <wp**********@hondutel.hn> wrote:
<form method="get" action="http://search.atomz.com/search/">
<input size="20" name="sp-q"><br>
<input type="submit" value="Search">
<input type="hidden" name="sp-a" value="sp06251400">
<input type="hidden" name="sp-p" value="any">
<input type="hidden" name="sp-f" value="ISO-8859-1">
</form>

This code validates as 4.01 Transitional but fails as Strict due to the
use of <input>, <button> being the prefered element in Strict.


Under strict the form element cannot directly contain inline elements
such as input, nest a block level container in the form element and
it'll validate.

<form method="get" action="http://search.atomz.com/search/">
<p>
<input size="20" name="sp-q"><br>
<input type="submit" value="Search">
<input type="hidden" name="sp-a" value="sp06251400">
<input type="hidden" name="sp-p" value="any">
<input type="hidden" name="sp-f" value="ISO-8859-1">
</p>
</form>

--
Spartanicus
Aug 1 '05 #3
Spartanicus wrote:
<form method="get" action="http://search.atomz.com/search/">
<p>

Erm, why do you both suggest <p>? The form contents look more like
a fieldset than a paragraph to me.

--
Nick Kew
Aug 1 '05 #4
Nick Kew <ni**@asgard.webthing.com> wrote:
Erm, why do you both suggest <p>?
Maybe because people think of <p> as a general block-level element.
The form contents look more like
a fieldset than a paragraph to me.


Well, maybe, but using the <fieldset> element makes a <legend> compulsory
by HTML syntax rules and triggers some browser bugs. Moreover, in a case
like this, <fieldset> has no tangible benefits. Hence I would use <div>,
which is a semantics-free block element and has no default effect upon
rendering.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Aug 1 '05 #5
Nick Kew <ni**@asgard.webthing.com> wrote:
<form method="get" action="http://search.atomz.com/search/">
<p>

Erm, why do you both suggest <p>? The form contents look more like
a fieldset than a paragraph to me.


Imo fieldset markup is for subdividing a form, the form in question has
only one section/group.

I generally use paragraph markup as a generic block level container
because unlike using a div it can be expected to provide spacing in the
visual domain, and a leading and trailing pause when rendered by a
speech browser. I don't subscribe to the belief that markup should be
strictly semantic. Imo markup should be functional first and foremost.

For example some consider <p><img ...><br>A caption</p> as incorrect
semantic markup since it's clearly not a paragraph. Imo it is
appropriate markup because of the aforementioned functionality it
provides.

That said, in this case the spacing and the leading and trailing pause
can be expected from the form element itself, so on reflection a div
seems the appropriate choice.

--
Spartanicus
Aug 1 '05 #6
On Mon, 1 Aug 2005, Warren Post wrote:
Fine, but I
can´t for the life of me figure out how to rewrite this code using
<button> instead of <input>, even after studying the examples in the HTML
4.0 Reference and googling. In fact, googling leaves me with the
impression that most folks don´t bother to validate their form
submission code, but my momma didn´t raise me that way.


´ is an acute accent.
' is an apostrophe.
Too bad that people with non-English European or American
keyboards all over the world now type accents (´ `) instead of
an apostrophe (').
See http://www.cl.cam.ac.uk/~mgk25/ucs/apostrophe.html .

--
Top-posting.
What's the most irritating thing on Usenet?

Aug 2 '05 #7
Andreas Prilop wrote:
On Mon, 1 Aug 2005, Warren Post wrote:
Fine, but I
can´t for the life of me figure out how to rewrite this code using
<button> instead of <input>, even after studying the examples in
the HTML 4.0 Reference and googling. In fact, googling leaves me
with the impression that most folks don´t bother to validate their
form submission code, but my momma didn´t raise me that way.


´ is an acute accent.
' is an apostrophe.
Too bad that people with non-English European or American
keyboards all over the world now type accents (´ `) instead of
an apostrophe (').
See http://www.cl.cam.ac.uk/~mgk25/ucs/apostrophe.html .


It's even moreso accessible on a Norwegian keyboard layout. This is
from my own laptop keyboard:
http://kimandre.com/img/apostrophe-norway.jpg

One keypress, and that's it!

You can barely see the grave accent and acute accent symbols on one of
the keys above (on the left of the backspace key), accessible by using
the shift key and the AltGr key (in that order). Now, that's two
keypresses (not including the space bar).

Btw, the picture above was taken using my mobile phone camera and
underwent some image post processing on my laptop.

--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Aug 2 '05 #8
On Tue, 02 Aug 2005 14:55:40 +0200, Andreas Prilop wrote:
Too bad that people with non-English European or American keyboards all
over the world now type accents (´ `) instead of an apostrophe ('). See
http://www.cl.cam.ac.uk/~mgk25/ucs/apostrophe.html .


My case is even worse: I have a U.S. keyboard, configured to
U.S./International. The apostrophe key gives me an acute accent, and the
quotation mark key gives me a ¨. It appeared when I upgraded from
Mandrake Linux 8.2 to 10.0, and I´ve been too lazy to look for a fix.
Thanks for the nudge and the URL.

--
Warren Post
Santa Rosa de Copán, Honduras
http://srcopan.vze.com/
Aug 6 '05 #9
On Mon, 01 Aug 2005 19:22:04 +0100, Philip Ronan wrote:
"Warren Post" wrote:
This code validates as 4.01 Transitional but fails as Strict due to the
use of <input>, <button> being the prefered element in Strict.


What gave you that impression? The DTD says a FORM element can contain
block elements and scripts. INPUT isn't a block element. That's why your
form doesn't validate.


Yes, upon rereading I see you are correct. I read the same thing you
did, but I jumped to an incorrect conclusion. Thanks for the clarification.

Additionally, the solution you and others provided of wrapping <input> in
a block level element works. Many thanks to all.

--
Warren Post
Santa Rosa de Copán, Honduras
http://srcopan.vze.com/
Aug 7 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Michael Hamm | last post: by
4 posts views Thread by Howard Jess | last post: by
10 posts views Thread by Phlip | last post: by
6 posts views Thread by snacktime | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.