Forum Moderators: open

Message Too Old, No Replies

Validating a small piece of code

no solution after a whole day of thinking....

         

malasorte

10:00 pm on Oct 3, 2006 (gmt 0)

10+ Year Member



It's almost 12 hours now since I try to validate this small pice of code to HTML 4.01 Transitional:

<td class="search-align">
<form method="get" action="http://www.example.com/search/search.pl" style="margin: 0;">
<input name="Terms" size="20" value=" search this site" class="search">

****
</td>
<td class="search-align">
****

<input name="src" type="submit" value="Go" class="search">
</form>
</td>

I need to validate this without removing this part:

****
</td>
<td class="search-align">
****

Is there a way? This thing is driving me crazy! Many thanks!

[edited by: malasorte at 10:21 pm (utc) on Oct. 3, 2006]

bedlam

10:19 pm on Oct 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's hard to tell from the way you've formatted your post, but it looks like you've got one or both of the following:

  1. incorrectly nested tags (<form> starts inside <tr> but ends inside <td>),
  2. elements inside containers they're not allowed to be in (<form> inside <tr>--only <td> and <td> can go inside <tr>)

-b

malasorte

10:23 pm on Oct 3, 2006 (gmt 0)

10+ Year Member



Sorry about that, that <tr> was supposed to be a <td> (typo). I have edited my first post.

bedlam

10:30 pm on Oct 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well then you've still got problem #1, incorrectly nested tags.

No element can open inside one <td> and close in another. You must start and finish your <form> inside one <td>, OR move the opening and closing form tags outside the table altogether.

-b

malasorte

10:52 pm on Oct 3, 2006 (gmt 0)

10+ Year Member



Bedlam tahnks for you help. This idea "OR move the opening and closing form tags outside the table altogether" looked great, and for a moment I thought the code will validate. But it didn't...

This code is for a simple search box, composed of the box in which you type the text and the "search button". I have the search box in one table and the button in another table, looks great. But it doesen't validate...

bedlam

10:55 pm on Oct 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Without seeing more code, it's impossible to give you more help ;-)

-b

malasorte

10:59 pm on Oct 3, 2006 (gmt 0)

10+ Year Member



Thanks anyway, I understand it's really hard (if not imposible) to come with a solution to a problem like this, online, on a forum.

piskie

11:11 pm on Oct 3, 2006 (gmt 0)

10+ Year Member



Could it be that style="margin: 0;" has no unit

Try
style="margin: none;"
or
style="margin: 0px;"

penders

11:41 pm on Oct 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If it helps, I've just rejigged your original example, and it now validates as HTML 4.01 Strict. I've basically done as bedlam originally suggested and "move(d) the opening and closing form tags outside the table altogether", plus adding the necessary <table> tags and closing a couple of open <td>s.

Valid HTML 4.01 Strict:

<form method="get" action="http://www.example.com/search/search.pl" style="margin: 0;"> 
<table><tr>

<td class="search-align">
<input name="Terms" size="20" value=" search this site" class="search">
</td>

<td class="search-align">
<input name="src" type="submit" value="Go" class="search">
</td>

<td>
<!-- I need to validate this without removing this part: -->
</td>

<td class="search-align">
<!-- Something else here? -->
</td>

</tr></table>
</form>

If that doesn't sort it then "it's something else" in the code, so we'll need to see more...

Could it be that style="margin: 0;" has no unit

Specifying 0 (zero) without any units is, I think, the recommended way and is perfectly valid. (but that is the CSS anyway, not the HTML)

malasorte

12:12 pm on Oct 4, 2006 (gmt 0)

10+ Year Member



WOW it worked! Penders, Bedlam, and Piskie thank you so much! I only had to paste the code and make some minor modifications to some tables in the site and there it was: the beautiful green screen "This Page Is Valid...".