Forum Moderators: open

Message Too Old, No Replies

<input> needs parent other than <form>?

missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADD

         

benihana

9:29 am on Oct 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try to validate as html4 strict and get the

document type does not allow element "INPUT" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag.

This doesnt seem to make sense to me. I need to wrap my inputs in a p or similar? Why?

form as follows:

<form method="get" action="search.php" id="searchbar">
<input type="hidden" value="XXXX" name="XXXX">
<label for="XXXX">Search in
<select name="XXXX">
<option value="all">All categories</option>
<option value="book">Books</option>
<option value="music">Music</option>
<option value="dvd">DVD</option>
<option value="video">Video</option>
</select>
</label>
<label for="XXXX">for
<input type="text" onfocus="this.value=''" name="XXXX" value="product search">
</label>
<input name="submit" type="submit" value="GO" class="btn">
</form>

dragonthoughts

9:54 am on Oct 12, 2005 (gmt 0)

10+ Year Member



Solution:
<form method="get" action="search.php" id="searchbar">
<input type="hidden" value="XXXX" name="XXXX">
<div>
<label for="XXXX">Search in
<select name="XXXX">
<option value="all">All categories</option>
<option value="book">Books</option>
<option value="music">Music</option>
<option value="dvd">DVD</option>
<option value="video">Video</option>
</select>
</label>
<label for="XXXX">for
<input type="text" onfocus="this.value=''" name="XXXX" value="product search">
</label>
<input name="submit" type="submit" value="GO" class="btn">
</div>
</form>

benihana

10:07 am on Oct 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I shoulfd have been clearer - i realise that will fix it.

Im wondering why its nessecary in terms of structure + semantics.?

benihana

10:21 am on Oct 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok ok i realised i missed off fieldset and legend - which i should have added and fixed it :(#

Though strangley the w3c validator didnt suggest this as an option