3 replies [Last post]
rev_shabbazz
Offline
Regular
Last seen: 14 years 50 weeks ago
Joined: 2005-04-22
Posts: 23
Points: 0

The validator keeps throwing an error about my form -- specifically, my inputs located here :: http://www.shakedownstreet.com/testing/index.php

The code ::

<form id="search" action="#">
<input type="text" name="search_text" id="search_text" value="Search Shakedown" />
<input type="submit" name="GO" id="submit" value="GO" />
</form>

The validator error ::

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

I'm at a total loss!

Any help?

rev_shabbazz
Offline
Regular
Last seen: 14 years 50 weeks ago
Joined: 2005-04-22
Posts: 23
Points: 0

&lt;Input&gt; won't validate for XHTML Validator

UPDATE::

I just updated the title and initial post to reflect the current status. I had an IE question listed along with the Validator question, but I resolved the IE question.

The IE Background problem I was having was solved by a position=relative. IE has been testing my nerves as of late...

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 12 hours 51 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9754
Points: 3836

&lt;Input&gt; won't validate for XHTML Validator

From the W3, http://www.w3.org/TR/html4/interact/forms.html#edef-FORM

<!ELEMENT FORM - - (%block;|SCRIPT)+ -(FORM) -- interactive form -->
That means a form may only contain one or more of block elements or scripts (it may not be empty), and may not contain another form.

An input is an inline element. Try this;

<form id="search" action="#">
  <fieldset>
    <input type="text" 
           name="search_text" 
           id="search_text" 
           value="Artist, type, title, etc" />
    <input type="submit" 
           name="GO" 
           id="submit" 
           value="GO" />
  </fieldset>
</form>
You could also wrap each input in a paragraph. A lot of folk use a div as a wrapper, but that's non-semantic.

A form example may be seen at http://garyblue.port5.com/webdev/form.html

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

rev_shabbazz
Offline
Regular
Last seen: 14 years 50 weeks ago
Joined: 2005-04-22
Posts: 23
Points: 0

&lt;Input&gt; won't validate for XHTML Validator

<Fieldset> did the trick! I'm validating with the best of them now! Would have NEVER come up with that on my own! Many thanks, Gary!!

-Tim