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

Industry Leaders: 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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
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 add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

765 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