Solved

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

Posted on 2013-05-10
4
216 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:Cornelia Yoder
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

728 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