Forum Moderators: open

Message Too Old, No Replies

multiple forms in the same table

form in column 1 and 5

         

weddingm

5:35 am on Jul 7, 2009 (gmt 0)

10+ Year Member



I would like to know if it is possible to have a form in column 1 as a check box for all rows (checkbox form to save to profile) and at the same time.... in column 5 a checkbox to do something else in a completely other form.

How can I have 2 forms in the same table?

andrewsmd

7:49 pm on Jul 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<table>
<tr><td><form name = "form1" method = "post" action="yourfile"><!--your tags here -->
</form></td></tr>
<tr><td><form name = "form2" method = "post" action="yourfile2"><!--your tags here -->
</form></td></tr>
</table>
That's not valid html but it will work unless you are using asp as a server side language. Why do you need two forms, and if so, are you using some sort of server side language to do anything with the data. If so, post your problems and I can help, I know php asp and perl.

lavazza

9:54 pm on Jul 7, 2009 (gmt 0)

10+ Year Member



My guess is that you are using tables to control your layout (as opposed to merely displaying tabular data)

If so, and you want to use valid HTML, consider using a CSS-based approach to controlling the layout

See Google ?q=css+layout sitesearch=webmasterworld.com [google.com] for ideas and start a thread in the CSS forum [webmasterworld.com] if/when you need/want help :)

rocknbil

5:19 pm on Jul 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why do you say it's not valid html?

Paste this into validate by direct input at W3C [validator.w3.org], it validates fine.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled</title>
</head>
<body>
<table>
<tr><td><form name="form1" method="post" action="yourfile"><!--your tags here -->
</form></td></tr>
<tr><td><form name="form2" method="post" action="yourfile2"><!--your tags here -->
</form></td></tr>
</table>
</body>
</html>

While using tables for layout is not semantically correct it's still valid html. Just make sure the opening and closing form tags are fully contained in the table cell, no overlapping.

You can do the same with a CSS based layout:

#right-form { float: right; width: 220px; }
#left-form { float: left; width: 220px; }

<form name="form1" id="left-form" method="post" action="">This form floats left</form>

<form name="form1" id="right-form" method="post" action="">This form floats right</form>

lavazza

11:59 pm on Jul 20, 2009 (gmt 0)

10+ Year Member



Why do you say it's not valid html?

Paste this into validate by direct input at W3C, it validates fine.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Valid TRANSITIONAL? Yes

Valid STRICT? No

tedster

2:03 am on Jul 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have many strict pages on many websites that use tables for layout - and they definitely validate. In fact, that's been my preference for creating easy "custom" cross-bowser layouts for the past several years.

No validator can tell whether the data in a table is truly "tabular" or not. An image, a sentence, a paragraph - they can all be tabular data.

There are semantic reasons for not choosing tables for layout, but table layout still can be valid mark-up.