Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Prototype: <form> inside a <table> doesn't work

    I have been trying Ajax.Request for a form which exists as such:

    </tr><form><tr><td></td></tr></form><form><tr> and so on....

    I have just discovered that Prototype doesn't support a form interleaved in a table.

    The forms must exist outside the table as such:
    <form><table><tr>.....</table></form>

    ..for it to submit the form successfully.

    Is there a way around it such that I can use Ajax.Request with the form interleaved in a table?

    Thanks in advance!

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Code:
    </tr><form><tr><td></td></tr></form><form><tr>
    Yes, because the above html is pretty invalid. You can't nest a form inside a table like that.
    Always validate your markup, when using complex javascript functions.

    PS: Check http://www.alistapart.com/articles/p...ccessibleforms to see how to make an accessible form layout.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Feb 2009
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I understand that, but how else can I achieve the objective?

    I want to make sure that all the columns have the same width. I can do that by making them all fixed-width - that is if I decide to make each tr row into a table (<form><table>). But then, some fields happen to be rather small (depending on the data fetched from the DB) which end up wasting space.

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    If you really want to nest a form inside a table, it should be placed inside a cell, like
    Code:
    <table>
    <tr>
    <td>
    <form...........
    </form>
    </td>
    </tr>
    <table>
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    New Coder
    Join Date
    Feb 2009
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I can do that but then the column widths won't be the same.

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by markjohnson View Post
    I can do that but then the column widths won't be the same.
    That's why I recommended to check the tutorial to make a semantic and accessible form layout without any tables.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •