Jump to content

Fails Validation As Form In Table Cells?


son

Recommended Posts

I have laid out some product variation data in a table with the abiltiy to change colour, size and quantity. It makes sense to have the input and drop-down fields in separate table cells, but now the validation throws up errors as the form is across two cells (it actually also complains when it is in one table cell, just less). I use the following doc type:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">Where am I going wrong?Son

Link to comment
Share on other sites

Two things:

  1. You cannot have inline elements directly inside a form:Example of incorrect code:
    <form>Text</form>OR<form><input></form>

  2. You cannot put anything directly inside a <table> element except <tr>, <thead>, <tfooter>, <tbody> and <caption>.You also cannot have anything directly inside a <tr> element except a <th> or <td> element.Example of incorrect code:
    <table>  <form>	<tr>	  <td></td>	  <td></td>	</tr>  </form></table>OR<table>  <tr>	<form>	  <td></td>	  <td></td>	</form>  </tr></table>

Link to comment
Share on other sites

Two things:
  1. You cannot have inline elements directly inside a form:Example of incorrect code:
    <form>Text</form>OR<form><input></form>

  2. You cannot put anything directly inside a <table> element except <tr>, <thead>, <tfooter>, <tbody> and <caption>.You also cannot have anything directly inside a <tr> element except a <th> or <td> element.Example of incorrect code:
    <table>  <form>	<tr>	  <td></td>	  <td></td>	</tr>  </form></table>OR<table>  <tr>	<form>	  <td></td>	  <td></td>	</form>  </tr></table>

But how would you do this otherwise? The data needs to be updateable...Son
Link to comment
Share on other sites

You can put the form around the whole table, or inside the table cell.

<form>  <table>	...	...  </table></form>OR<table>  <tr>	<td>	  <form></form>	</td>  </tr></table>

As for elements inside the form, you can put them in <div> or <fieldset> elements:

<form>  <fieldset>	Text	<input/>  </fieldset></form>

Link to comment
Share on other sites

This is what I also tried. I had:
<table><tr><td><form><input>other form elements</form></td></tr></table>

and validation still had issues with that...Son

You can't put input elements directly inside a form element. I already mentioned it before. Quoted from my previous post:
As for elements inside the form, you can put them in <div> or <fieldset> elements:
<form>  <fieldset>	Text	<input/>  </fieldset></form>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...