Solved

HTML Table - <Form> field causes row to become 2 lines, even with only 1 char of data?!

Posted on 2013-05-10
4
214 Views
Last Modified: 2013-05-14
I've tried this with a very basic table to keep it simple - here's the code:

<table>
  <tr>
    <td>Heading Row</td>
  </tr>
  <tr height="1">
    <td><form id="form1" method="post" name="form1" action="action.php">
    Form Row
    </form></td>
  </tr>
  <tr>
    <td>Row 3</td>
  </tr>
</table>

Open in new window


"Heading Row" is at a single row height
"Form Row" takes up 2 lines in the table
"Row 3" takes up a single line.

(Using IE10)

In chrome and firefox this works fine, but I need it to work properly in IE!

Anyone have any ideas how to fix it? The final version will be several hidden fields with a small submit button (css / javascript text) - if I add the hidden fields without any button or text it works fine (one line) but as soon as I add any text into that column, between the form tags it turns into two lines height?

Thanks
0
Comment
Question by:Bergstr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 11

Accepted Solution

by:
netballi earned 500 total points
ID: 39155122
simply do this
<table>
  <tr>
    <td>Heading Row</td>
  </tr>
  <tr height="1">
    <form id="form1" method="post" name="form1" action="action.php">
    <td>Form Row</td>
    </form>
  </tr>
  <tr>
    <td>Row 3</td>
  </tr>
</table>



Instead of defining <td> outside the <form > tab place it around the text.
0
 
LVL 27

Expert Comment

by:yodercm
ID: 39155236
Expanding on what netballi said,  the best way to deal with forms and tables is to put the form completely outside the table if you can.


<form id="form1" method="post" name="form1" action="action.php">
<table>
  <tr>
    <td>Heading Row</td>
  </tr>
  <tr height="1">
    <td>Form Row</td>
  </tr>
  <tr>
    <td>Row 3</td>
  </tr>
</table>
</form>

Open in new window

0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39155642
You will have fewer problems if you use the proper tags to build the structure.  Tables are for tabular data, not structural layout.  Use fieldsets and you will will have more control, better cross-browser compatibility, and it will be semantically correct.

Cd&
0
 

Author Comment

by:Bergstr
ID: 39163795
netballi - that worked perfectly! thanks for the response.

Yodercm - I need to have several forms in one table, so unfortunately that wouldn't work.

COBOLdinosaur - It is actually tabular data I'm looking to use, but id like an edit field for each row of data hence the form.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question