View Full Version : Prototype: <form> inside a <table> doesn't work
markjohnson
03-12-2009, 06:38 PM
I have been trying Ajax.Request for a form which exists as such:
</tr><form><tr><td></td></tr></form><form><tr> and so on....
I have just discovered that Prototype doesn't support a form interleaved in a table.
The forms must exist outside the table as such:
<form><table><tr>.....</table></form>
..for it to submit the form successfully.
Is there a way around it such that I can use Ajax.Request with the form interleaved in a table?
Thanks in advance!
abduraooft
03-12-2009, 06:44 PM
</tr><form><tr><td></td></tr></form><form><tr>Yes, because the above html is pretty invalid. You can't nest a form inside a table like that.
Always validate your markup (http://validator.w3.org/#validate_by_input), when using complex javascript functions.
PS: Check http://www.alistapart.com/articles/prettyaccessibleforms to see how to make an accessible form layout.
markjohnson
03-12-2009, 08:14 PM
I understand that, but how else can I achieve the objective?
I want to make sure that all the columns have the same width. I can do that by making them all fixed-width - that is if I decide to make each tr row into a table (<form><table>). But then, some fields happen to be rather small (depending on the data fetched from the DB) which end up wasting space.
abduraooft
03-12-2009, 08:28 PM
If you really want to nest a form inside a table, it should be placed inside a cell, like
<table>
<tr>
<td>
<form...........
</form>
</td>
</tr>
<table>
markjohnson
03-12-2009, 09:53 PM
I can do that but then the column widths won't be the same.
abduraooft
03-13-2009, 08:41 AM
I can do that but then the column widths won't be the same.
That's why I recommended to check the tutorial to make a semantic (http://boagworld.com/technology/semantic_code_what_why_how/) and accessible form layout without any tables.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.