Re: Slightly ugly output
- From: "rf" <rf@xxxxxxxxx>
- Date: Mon, 2 Aug 2010 18:04:12 +1000
"lrhorer" <lrhorer@xxxxxxxxxxx> wrote in message
With forms within tables: the form must be entirely within a single
cell of the table. It can not be spread across one two or more cells
or rows, as you are doing.
That doesn't make much sense to me, at all.
It's very simple. If you have a form *inside* a table then it must be
entirely within one single <td>.
I'm not looking to put a form inside a table. I am looking for the
form to span a table (actually, more than one table), with form
elements (checkboxes) assigned to elements of the table. The problem
is, putting two entities side-by-side requires the two entities both to
be part of the same table row.
If you wish a table to be inside a form then the entire table must be
inside the form.
That's not what you said.
No, it's not what I said last time. That is because I was extending the
information to cater for "the other way round". My prior statement was about
forms inside tables. This new one is about tables inside forms, which is
what you really want anyway.
You said the entire form must be inside a
single cell. On the pupdate.cgi sheet, placing all the tables wholly
within the extents of the form is no problem.
OK. Problem solved.
<table><tr><td><form></form></td></tr></table> is valid.
<form><table> ... </table></form> is valid.
<table><form><tr> is not valid.
How, then, is one to pass
parameters from multiple rows of a table (one checkbox per row, for
example - see
Put the entire table inside the form. That's the only valid way.
See above. The question, though, still remains. Assume I place
tables entirely within the extents of form #1, with one element of a
one line table being on the left hand side of the sheet (it can be half
the width of the form above it, if need be) at the bottom. Now how do
I place a second form on the same line with the table to the right of
the one line, narrow table?
You don't. You have exactly one form, containing a big table, or a number of
tables, or whatever you want. How you organise your input fields is up to
you, but rememeber that they *all* can have different names, and your submit
buttons can *all* have different names, and your server side processing can
choose which input fields to consider depending on what submit button was
to another spreadsheet? With one form per tr, I would only be able
to pass 1 value to the profile.cgi script when the user clicked
How would you implement the two pages? Using multiple divs? That
would make the scripts horribly more complex, especially for the
Why? You could name your Add submit buttons differently for each
section and fork in your script accordingly.
Unless I am missing something, a single form can only spawn to a
page. It can't spawn conditionally to one of two pages.
I didn't say it could. Your form causes one single server side process to
run. That server side process forks (with a big if statement, or maybe a
case) depending on which submit button was activated. If the submit button
named "delete_weekays" was successfull then you consider the checkboxes
named "line_weekdays". Similarly for delete_weekends and line_weekends.
On closer inspection (now that you have provided a URL) I see that you
are nesting forms as well.
I am not nesting any forms. Every <form ...> is followed by a
prior to any other form being opened.
Ah, yes, on looking at the source code you do exactly that.
I was looking at the HTML tab on firebug, effectively the DOM *. Since your
HTML is invalid it seems that firefox has decided that the forms *are*
nested. It must have thrown out the first </form>, since it is in an invalid
position (you cannot have a </form> between a </tr> and a </table>) and
inserted a </form> just before the </body> to close the still open outer
* the DOM contains a body containing a table (your heading) and a form.
The form contains two tables. The first contains your input fields and their
associated headings. The second table contains two cells, the ones I
mentioned before as causing your alignment problem. The first cell contains
the "submit" button. The second cell contains a form that contains the
"abort" button. It is this form that is nested within the outer form
As I said, with invalid code it is up to the browser to do whatever it
wants. And, in this case, it's doing something entirely different that what
you think you have specified. You may think you have not nested the forms.
The browser thinks differently.
This is also probably why you failed to spot the alignment error. From
looking at the source code it is not even there. Only when the browser has
error corrected your code to what it is happy with, and introduces that
nested table, does your problem appear.
Now, do you think it might be a good idea to take your code over to the
validator and fix *all* the errors? :-)