Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-05-10
4
Medium Priority
?
220 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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.…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

618 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