Hi.
I'm having trouble validating one of the forms in our table. Other forms validate, but this one doesn't want to work.
The form is designed to have 3 drop down selectors and a go button. They are meant to display in one row, with about 8 cells (3 drop downs, 1 go button, 3 spacers).
It currently displays correctly, but doesn't validate. The validator complains that:
1. document type does not allow element "FORM" here.
and
2. document type does not allow element "TR" here.
Whenever I try and rearrange the tags, the display gets horribly messed up. It displays correctly now, but doesn't validate.
The code looks like this:
<body>
<table>
<tr><td>bunch of stuff</td></tr>
<form action="search.php" method="get" name="SearchPullDown">
<tr>
<td width="192" height="36" colspan="5"> <img src=http://www.webdeveloper.com/forum/archive/index.php/"images/image1.gif" alt="" ></td>
<td width="158" height="36" colspan="9" class="tableclass1">
<select name="selectname1" class="selectclass" id="id1" style="width:146px; height:20px;">
<option value="Option1" >Option 1</option>
</select></td>
<td width="30" height="36"> <img src=http://www.webdeveloper.com/forum/archive/index.php/"images/abc.gif" alt="" ></td>
<td width="154" height="36" colspan="5" class="tableclass2">
<select name="selectname2" class="selectclass" id="id2" style="width:146px; height:20px;">
<option value="Option2" >Option 2</option>
</select></td>
<td width="23" height="36" colspan="4"> <img src=http://www.webdeveloper.com/forum/archive/index.php/"images/lmn.gif" alt="" ></td>
<td width="157" height="36" colspan="5" class="tableclass3">
<select name="selectname3" class="selectclass" id="id3" style="width:146px; height:20px;">
<option value="Option3">Option3</option>
</select></td>
<td width="61" height="36" colspan="3">
<input type="image" src=http://www.webdeveloper.com/forum/archive/index.php/"images/zyx.gif" alt="Find"></td>
</tr>
</form>
</table>
</body>
Any help much appreciated. Thanks in advance.
-Going crazy in seattle1) Don't use HTML 4, it had a few problems. Use instead HTML 4.01.
2) Don't use a transitional version, they're just temporary and no longer necessary. Use HTML 4.01 Strict.
3) Don't use TABLEs for layout!
But you're not going to pay attention to three above, and possibly not to one and two, and while you can't use TABLEs to layout your page you may use them for a FORM. But you must clearly put element label in LABEL elements that are in turn each in a TH element. And you must properly use the "for" attribute. And while TABLE elements cannot directly contain FORM elements, FORM elements may contain TABLE elements.Thanks for reply. To you points.
1. Done: Actually I am using 4.01
2. I'll try an validate with strict and see if I can comply to that.
3. I think I'm too far in to consider not using a table at this point. Maybe down the road.
If a table cannot contain a form, how do you get the form in there? The entire web page starts and ends with a table.If you are using TABLEs for layout then just give up on validation. You are too far gone, and living too close to Redmond, to be saved.I don't know. Maybe I don't understand.
I've been working on the validation & I'm down to 3 errors from over 1000. Those 2 I just posted are the 2 of the 3. The 3rd is that I don't have a doc type tag.
If I can fix these 2 things, my page should validate.
....based on your post, I'm guessing this will be a stupid question, but: Don't all web pages rely on tables to display information? Seems tables, table rows, and table cells are the way to break up the page....what am I missing?CSS is the way to define the appearance of a page - fonts, positioning etc.
Tables are intended for displaying tabular data. Tabular data in a table would normally have column and/or row headings, possibly a caption to describe what the table is about, and would look acceptable with borders around each cell.what am I missing?The most fundamental understanding of what HTML is. HTML is about the content and meaning of your document. CSS is about the presentation. Moreover:From the HTML 4.01 Specification:
Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media. Additionally, when used with graphics, these tables may force users to scroll horizontally to view a table designed on a system with a larger display. To minimize these problems, authors should use style sheets to control layout rather than tables.
<!-- m --><a class="postlink" href="http://www.w3.org/TR/html401/struct/tables.htmlAhh">http://www.w3.org/TR/html401/struct/tables.htmlAhh</a><!-- m -->. So I'm closer than it looks. We use a css file to drive all the formatting on our pages. (where we didn't - I have gone back a recoded during this effort to validate).
Also, our site is heavily data driven - php/mysql. The form above is on every page to let the user revise their search results.
Anyway, I really want to fix this error. I again tried to change the tags around to put the form tags outside the table, but I'm still having trouble. Do you have some specific suggestions to alter my code to make this validate?
Thanks.Make certain that you are properly using TH, TD and LABEL elements and put the FORM tags outside of the TABLE.Make certain that you are properly using TH, TD and LABEL elements and put the FORM tags outside of the TABLE.
But isn't TD a table row? So, doesn't td have to be inside <table>? But if (according to w3c, form can be inside, td, but not inside table. But td is inside table....hence my confusion.
Sorry for the newbie questions.A <form> either has to be completely inside of one <td> or the <table> has to be completely inside the <form>. Any other variant will give a nesting error on the tags like you have with your code.
Nothing may go between a <table> tag and a <tr> tag except for a <thead>, <tfoot>, or <tbody> tag and nothing can ever go between a <tr> tag and a <td> tag. Similarly for between the corresponding end tags. The placement of your <form> tag is invalid.
I'm having trouble validating one of the forms in our table. Other forms validate, but this one doesn't want to work.
The form is designed to have 3 drop down selectors and a go button. They are meant to display in one row, with about 8 cells (3 drop downs, 1 go button, 3 spacers).
It currently displays correctly, but doesn't validate. The validator complains that:
1. document type does not allow element "FORM" here.
and
2. document type does not allow element "TR" here.
Whenever I try and rearrange the tags, the display gets horribly messed up. It displays correctly now, but doesn't validate.
The code looks like this:
<body>
<table>
<tr><td>bunch of stuff</td></tr>
<form action="search.php" method="get" name="SearchPullDown">
<tr>
<td width="192" height="36" colspan="5"> <img src=http://www.webdeveloper.com/forum/archive/index.php/"images/image1.gif" alt="" ></td>
<td width="158" height="36" colspan="9" class="tableclass1">
<select name="selectname1" class="selectclass" id="id1" style="width:146px; height:20px;">
<option value="Option1" >Option 1</option>
</select></td>
<td width="30" height="36"> <img src=http://www.webdeveloper.com/forum/archive/index.php/"images/abc.gif" alt="" ></td>
<td width="154" height="36" colspan="5" class="tableclass2">
<select name="selectname2" class="selectclass" id="id2" style="width:146px; height:20px;">
<option value="Option2" >Option 2</option>
</select></td>
<td width="23" height="36" colspan="4"> <img src=http://www.webdeveloper.com/forum/archive/index.php/"images/lmn.gif" alt="" ></td>
<td width="157" height="36" colspan="5" class="tableclass3">
<select name="selectname3" class="selectclass" id="id3" style="width:146px; height:20px;">
<option value="Option3">Option3</option>
</select></td>
<td width="61" height="36" colspan="3">
<input type="image" src=http://www.webdeveloper.com/forum/archive/index.php/"images/zyx.gif" alt="Find"></td>
</tr>
</form>
</table>
</body>
Any help much appreciated. Thanks in advance.
-Going crazy in seattle1) Don't use HTML 4, it had a few problems. Use instead HTML 4.01.
2) Don't use a transitional version, they're just temporary and no longer necessary. Use HTML 4.01 Strict.
3) Don't use TABLEs for layout!
But you're not going to pay attention to three above, and possibly not to one and two, and while you can't use TABLEs to layout your page you may use them for a FORM. But you must clearly put element label in LABEL elements that are in turn each in a TH element. And you must properly use the "for" attribute. And while TABLE elements cannot directly contain FORM elements, FORM elements may contain TABLE elements.Thanks for reply. To you points.
1. Done: Actually I am using 4.01
2. I'll try an validate with strict and see if I can comply to that.
3. I think I'm too far in to consider not using a table at this point. Maybe down the road.
If a table cannot contain a form, how do you get the form in there? The entire web page starts and ends with a table.If you are using TABLEs for layout then just give up on validation. You are too far gone, and living too close to Redmond, to be saved.I don't know. Maybe I don't understand.
I've been working on the validation & I'm down to 3 errors from over 1000. Those 2 I just posted are the 2 of the 3. The 3rd is that I don't have a doc type tag.
If I can fix these 2 things, my page should validate.
....based on your post, I'm guessing this will be a stupid question, but: Don't all web pages rely on tables to display information? Seems tables, table rows, and table cells are the way to break up the page....what am I missing?CSS is the way to define the appearance of a page - fonts, positioning etc.
Tables are intended for displaying tabular data. Tabular data in a table would normally have column and/or row headings, possibly a caption to describe what the table is about, and would look acceptable with borders around each cell.what am I missing?The most fundamental understanding of what HTML is. HTML is about the content and meaning of your document. CSS is about the presentation. Moreover:From the HTML 4.01 Specification:
Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media. Additionally, when used with graphics, these tables may force users to scroll horizontally to view a table designed on a system with a larger display. To minimize these problems, authors should use style sheets to control layout rather than tables.
<!-- m --><a class="postlink" href="http://www.w3.org/TR/html401/struct/tables.htmlAhh">http://www.w3.org/TR/html401/struct/tables.htmlAhh</a><!-- m -->. So I'm closer than it looks. We use a css file to drive all the formatting on our pages. (where we didn't - I have gone back a recoded during this effort to validate).
Also, our site is heavily data driven - php/mysql. The form above is on every page to let the user revise their search results.
Anyway, I really want to fix this error. I again tried to change the tags around to put the form tags outside the table, but I'm still having trouble. Do you have some specific suggestions to alter my code to make this validate?
Thanks.Make certain that you are properly using TH, TD and LABEL elements and put the FORM tags outside of the TABLE.Make certain that you are properly using TH, TD and LABEL elements and put the FORM tags outside of the TABLE.
But isn't TD a table row? So, doesn't td have to be inside <table>? But if (according to w3c, form can be inside, td, but not inside table. But td is inside table....hence my confusion.
Sorry for the newbie questions.A <form> either has to be completely inside of one <td> or the <table> has to be completely inside the <form>. Any other variant will give a nesting error on the tags like you have with your code.
Nothing may go between a <table> tag and a <tr> tag except for a <thead>, <tfoot>, or <tbody> tag and nothing can ever go between a <tr> tag and a <td> tag. Similarly for between the corresponding end tags. The placement of your <form> tag is invalid.