Form in one row of table

K

Krycek

I want to create form that will take one row of a table. I use it with PHP
script whith taking data from database and should create something like
this:

<table>
<tr><th>Col name1</th><th>Col name2</th><th>Col
name3</th><th>Options</th></tr>
<!-- First row -->
<form><tr><td><input ... /></td><td><input ... /></td><td><input ...
/></td><td><input type="submit" name="action" value="Save" /><input
type="submit" name="action" value="Delete" /></td></tr></form>
<!-- Second row -->
<form><tr><td><input ... /></td><td><input ... /></td><td><input ...
/></td><td><input type="submit" name="action" value="Save" /><input
type="submit" name="action" value="Delete" /></td></tr></form>

....
</table>

But when I generate code like above Opera adds break line before table for
every </form> tag so if I have a lot of rows table isn't in top of page.
Also code like above is not valid HTML 4.01 Transitional (acording to W3
org validator).
When I delete </form> tag from source everything is ok (but of course code
still is not valid).

Does enyone know how I should resolve that problem? It is important to me
to generate valid HTML 4.01 Transitional code.

Thanx for help.
 
J

Jedi Fans

Krycek said:
I want to create form that will take one row of a table. I use it with
PHP script whith taking data from database and should create something
like this:

<table>
<tr><th>Col name1</th><th>Col name2</th><th>Col
name3</th><th>Options</th></tr>
<!-- First row -->
<form><tr><td><input ... /></td><td><input ... /></td><td><input ...
/></td><td><input type="submit" name="action" value="Save" /><input
type="submit" name="action" value="Delete" /></td></tr></form>
<!-- Second row -->
<form><tr><td><input ... /></td><td><input ... /></td><td><input ...
/></td><td><input type="submit" name="action" value="Save" /><input
type="submit" name="action" value="Delete" /></td></tr></form>

...
</table>

But when I generate code like above Opera adds break line before table
for every </form> tag so if I have a lot of rows table isn't in top of
page. Also code like above is not valid HTML 4.01 Transitional
(acording to W3 org validator).
When I delete </form> tag from source everything is ok (but of course
code still is not valid).

Does enyone know how I should resolve that problem? It is important to
me to generate valid HTML 4.01 Transitional code.

Thanx for help.
<style type="text/css"><!--
form{margin:0;}
//--></style>
 
S

Steve Pugh

Krycek said:
I want to create form that will take one row of a table. I use it with PHP
script whith taking data from database and should create something like
this:

<!-- First row -->
<form><tr><td><input ... /></td><td><input ... /></td><td><input ...
/></td><td><input type="submit" name="action" value="Save" /><input
type="submit" name="action" value="Delete" /></td></tr></form>

But when I generate code like above Opera adds break line before table for
every </form> tag so if I have a lot of rows table isn't in top of page.
Also code like above is not valid HTML 4.01 Transitional (acording to W3
org validator).
When I delete </form> tag from source everything is ok (but of course code
still is not valid).

Does enyone know how I should resolve that problem? It is important to me
to generate valid HTML 4.01 Transitional code.

Use one single form around the whole table and modify the script on
the server that receives the form input accordingly.

Steve
 
S

Steve Pugh

Jedi Fans said:
<style type="text/css"><!--
form{margin:0;}
//--></style>

Do you really think that this will make the code valid HTML 4.01? And
do you really think that the HTML comments are needed? And why on
earth include the JavaScript style comment on the last line?

Steve
 
K

Krycek

Dnia Sun, 24 Jul 2005 16:59:16 +0200, Jedi Fans
<style type="text/css"><!--
form{margin:0;}
//--></style>


Thanks. It works = removes break lines. But code is still invalid becouse
<form> can't be nested in <table> withouth <TD>.

Anyway - Thank You - half of my problem is resolved.
 
K

Krycek

Use one single form around the whole table and modify the script on
the server that receives the form input accordingly.

Steve

It is some solution... but table will be big and sending each time all
data from it to server and back seems waste time of user which browsing
the page. Of course I could use JavaScript to reduce it but it make page
vulnerable for user agent.

If I wan't have a choice I will do like You say.

Thanks for help anyway.

--
 
J

Jonathan N. Little

Krycek said:
Thanks. It works = removes break lines. But code is still invalid
becouse <form> can't be nested in <table> withouth <TD>.

Correct, you cannot put FORM tag between TABLE and TR. Entire FORM can
go within a TD pair or encompass the entire TABLE. I think what you are
trying to do the latter is your course. Make a separate table for each form.

<!-- 1st Row -->
<form><table><tr><td> ... </td> ... <td> ... </td></tr></table></form>
..
..
..
<!-- nth Row -->
<form><table><tr><td> ... </td> ... <td> ... </td></tr></table></form>
 
K

Krycek

Dnia Sun, 24 Jul 2005 17:53:52 +0200, Jonathan N. Little
Correct, you cannot put FORM tag between TABLE and TR. Entire FORM can
go within a TD pair or encompass the entire TABLE. I think what you are
trying to do the latter is your course. Make a separate table for each
form.

<!-- 1st Row -->
<form><table><tr><td> ... </td> ... <td> ... </td></tr></table></form>
.
.
.
<!-- nth Row -->
<form><table><tr><td> ... </td> ... <td> ... </td></tr></table></form>

Yes - I thought about it but result of this solution is that I can't
guarantee that widths of cells in the same column and other
"rows" (in quote becouse it is separate table now) will be the same. Even
if I write them explicite if content of cell is bigger then only that cell
grow not all "column" (in quote due to same reason as above ;) ).

But thank You very much for proposal of solution.
 
J

Jeff Thies

Krycek said:
It is some solution... but table will be big and sending each time all
data from it to server and back seems waste time of user which browsing
the page.

Maybe you need to rethink your architecture. Don't worry so much about
server time (after all you are still loading the whole table, the amount
of data sent to the server is a fraction of that). Think about ease of
use for your client. You could easily rewrite this so it makes the whole
form editable so your clients don't have to edit a single row at a time.
Editing several rows that way is a drag.

Jeff


Of course I could use JavaScript to reduce it but it make
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top