Forum Moderators: open

Message Too Old, No Replies

Form within TABLE - not validating

         

adni18

2:56 am on Feb 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi. I have a table and a form like so:

<TABLE>
<FORM>
<TR>
<TD>
<INPUT name="element1">
</TD>
<TD>
<INPUT name="element2"><br>
<INPUT type="submit">
</TD>
</TR>
</FORM>
</TABLE>

The only problem is that this does not validate. I have tried putting the form around the table, but the table is very large and contains another form. Where can I put the start and end tags of the FORM that is valid? I want to stay away from javascript if I can, because my visitors are unlikely to have it set to 'allow'. Please help ASAP.

BlobFisk

9:48 am on Feb 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey adni18,

This is a common problem with sites that use large tables for positioning - you end up trying to figure out where to put your forms!

Technically a form should be around the table, you may even get away with it being inside a <td>. It should not, however, be opened between a <table> and <tr> tag, or a <tr> and <td> tag. There is just no "space" here for it!

You may have to make a difficult choice: consider changing the way that you are using tables or relax your attitude to validating your code.

Good luck!

adni18

1:18 pm on Feb 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, BlobFisk. I decided to merge a few cells and then create another smaller table within, keeping the form at a float:left style so it won't appear. Thanks!

rocknbil

1:49 am on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unrelated to this problem (I think?) but I struggled with this one forever - most because of that #%$%#%# space you get after the closing form tag, which would blow up the layout - and saw that some popular BB's out there do exactly what you've done, create incorrectly nested tags to fool the browser, but it remains . . . incorrectly nested. Don't know if it will work for you, but I finally got past it by playing around with the margin and padding of the form tags

form.nospace { padding:0; margin:0; }

And now the forms don't get all pushy with the rest of the page. :-)