Form in one row of table

Discussion in 'HTML' started by Krycek, Jul 24, 2005.

  1. Krycek

    Krycek Guest

    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.

    --
     
    Krycek, Jul 24, 2005
    #1
    1. Advertising

  2. Krycek

    Jedi Fans Guest

    Krycek wrote:
    > 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>
     
    Jedi Fans, Jul 24, 2005
    #2
    1. Advertising

  3. Krycek

    Steve Pugh Guest

    Krycek <> wrote:

    >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

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Jul 24, 2005
    #3
  4. Krycek

    Steve Pugh Guest

    Jedi Fans <"news[at]jedifans[--=dot==-]com"> wrote:
    >Krycek wrote:
    >>
    >> Does enyone know how I should resolve that problem? It is important to
    >> me to generate valid HTML 4.01 Transitional code.
    >>

    ><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

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Jul 24, 2005
    #4
  5. Krycek

    Krycek Guest

    Dnia Sun, 24 Jul 2005 16:59:16 +0200, Jedi Fans
    <"news[at]jedifans[--=dot==-]com"> napisa³:

    > <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.

    --
    krycek
     
    Krycek, Jul 24, 2005
    #5
  6. Krycek

    Krycek Guest

    Dnia Sun, 24 Jul 2005 17:24:45 +0200, Steve Pugh <> napisa³:

    >
    > 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.

    --
     
    Krycek, Jul 24, 2005
    #6
  7. Krycek wrote:

    > 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>

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Jul 24, 2005
    #7
  8. Krycek

    Krycek Guest

    Dnia Sun, 24 Jul 2005 17:53:52 +0200, Jonathan N. Little
    <> napisa³:

    > Krycek wrote:
    >
    >> 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>
    >


    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.

    --
    krycek
     
    Krycek, Jul 24, 2005
    #8
  9. Krycek

    Jeff Thies Guest

    Krycek wrote:

    > Dnia Sun, 24 Jul 2005 17:24:45 +0200, Steve Pugh <> napisa³:
    >
    >>
    >> 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.


    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
    > page vulnerable for user agent.
    >
    > If I wan't have a choice I will do like You say.
    >
    > Thanks for help anyway.
    >
     
    Jeff Thies, Jul 24, 2005
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luis Esteban Valencia

    My addnew row button is only adding one row?

    Luis Esteban Valencia, Mar 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    860
    Luis Esteban Valencia
    Mar 23, 2005
  2. Anon
    Replies:
    2
    Views:
    949
    Jukka K. Korpela
    Mar 18, 2005
  3. phl
    Replies:
    1
    Views:
    4,376
    Martin Jay
    Jun 8, 2006
  4. D
    Replies:
    0
    Views:
    230
  5. Giggle Girl

    ie6 Insert Row at specific Row Index of Table

    Giggle Girl, Feb 5, 2006, in forum: Javascript
    Replies:
    18
    Views:
    297
    Thomas 'PointedEars' Lahn
    Feb 7, 2006
Loading...

Share This Page