Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 1st, 2005, 07:15 PM
Warren Post
Guest
 
Posts: n/a
Default <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/
  #2  
Old August 1st, 2005, 07:25 PM
Philip Ronan
Guest
 
Posts: n/a
Default Re: <form> in 4.01 Strict

"Warren Post" wrote:
[color=blue]
> This code validates as 4.01 Transitional but fails as Strict due to the
> use of <input>, <button> being the prefered element in Strict.[/color]

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/


  #3  
Old August 1st, 2005, 07:35 PM
Spartanicus
Guest
 
Posts: n/a
Default Re: <form> in 4.01 Strict

Warren Post <wpost.nospam@hondutel.hn> wrote:
[color=blue]
><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.[/color]

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
  #4  
Old August 1st, 2005, 11:05 PM
Nick Kew
Guest
 
Posts: n/a
Default Re: <form> in 4.01 Strict

Spartanicus wrote:
[color=blue]
> <form method="get" action="http://search.atomz.com/search/">
> <p>[/color]


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

--
Nick Kew
  #5  
Old August 1st, 2005, 11:45 PM
Jukka K. Korpela
Guest
 
Posts: n/a
Default Re: <form> in 4.01 Strict

Nick Kew <nick@asgard.webthing.com> wrote:
[color=blue]
> Erm, why do you both suggest <p>?[/color]

Maybe because people think of <p> as a general block-level element.
[color=blue]
> The form contents look more like
> a fieldset than a paragraph to me.[/color]

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

  #6  
Old August 2nd, 2005, 12:35 AM
Spartanicus
Guest
 
Posts: n/a
Default Re: <form> in 4.01 Strict

Nick Kew <nick@asgard.webthing.com> wrote:
[color=blue][color=green]
>> <form method="get" action="http://search.atomz.com/search/">
>> <p>[/color]
>
>
>Erm, why do you both suggest <p>? The form contents look more like
>a fieldset than a paragraph to me.[/color]

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
  #7  
Old August 2nd, 2005, 02:05 PM
Andreas Prilop
Guest
 
Posts: n/a
Default Re: <form> in 4.01 Strict

On Mon, 1 Aug 2005, Warren Post wrote:
[color=blue]
> 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.[/color]

´ 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?

  #8  
Old August 2nd, 2005, 03:45 PM
Kim André Akerĝ
Guest
 
Posts: n/a
Default Re: <form> in 4.01 Strict

Andreas Prilop wrote:
[color=blue]
> On Mon, 1 Aug 2005, Warren Post wrote:
>[color=green]
> > 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.[/color]
>
> ´ 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 .[/color]

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ĝ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
  #9  
Old August 6th, 2005, 08:55 PM
Warren Post
Guest
 
Posts: n/a
Default Re: <form> in 4.01 Strict

On Tue, 02 Aug 2005 14:55:40 +0200, Andreas Prilop wrote:
[color=blue]
> 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 .[/color]

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/
  #10  
Old August 7th, 2005, 02:05 AM
Warren Post
Guest
 
Posts: n/a
Default Re: <form> in 4.01 Strict - SOLVED

On Mon, 01 Aug 2005 19:22:04 +0100, Philip Ronan wrote:
[color=blue]
> "Warren Post" wrote:
>[color=green]
>> This code validates as 4.01 Transitional but fails as Strict due to the
>> use of <input>, <button> being the prefered element in Strict.[/color]
>
> 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.[/color]

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/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles