Solved

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

Posted on 2013-05-10
4
209 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
4 Comments
 
LVL 11

Accepted Solution

by:
netballi earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses how to create an extensible mechanism for linked drop downs.
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.…
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 …

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now