views:

1732

answers:

4

I am trying to display two form submit buttons on the same line inside a table. In IE7 the following code works great, however in IE8 the Delete button drops down to the next line even though I declared the form to display inline. Any suggestions?

I created a basic test page here to show the issue: http://ajondeck.net/test/displayinline.html

+1  A: 

Your example doesn't work primarily because your HTML isn't valid. You open a td, put Submit1 and then close a form element?? Fix that and a lot of problems probably go away.

If you want two buttons side by side, you should just be able to put them in the same container.

cletus
What do you mean, "put them in the same container"
aherrick
Like in the same cell (td), div, span, p, etc.
cletus
right but they cannot be in two separate forms like my test setup?
aherrick
Oh you actually want two separate forms? It's hard to figure out what you want exactly from your page because the HTML is pretty broken. Maybe you should restate the desired result.
cletus
OK basically as much as possible I would like to have the first form be able to submit the text box field, but also have the second form button sit on the same line (next to) the first form button. Clear?
aherrick
A: 

If you want a quick solution you should enlarge the size of the td using css.

<td style="width:300px"> 
    <input id="Submit1" type="submit" value="Submit" name="Submit1"/>
    <form id="form2" action="www.test.com/test2" method="post" name="form2">
        <input id="Delete" type="submit" value="Delete" name="Delete"/>
    </form>

But the important thing here is that this kind of form is awfully coded man. Try to read about divs and css, tables are your worst enemy!

Hope you find this useful: http://www.cssdrive.com/index.php/examples/exampleitem/tableless_forms/P30/

Santi
I don't see how increasing the width of the TD gets me anywhere.
aherrick
A: 

There's nothing wrong with using tables for layout. I think that whole "anti-table" crowd are just a bunch of 3l33t1st snobs. ;-) Tables are universally supported in ALL browsers. They are from ancient days. They are stable. The are properly rendered by all browsers.

divs and spans are not. There are significant differences between ie, ff, opera, safari, etc over how things like css styles (such as "padding" or "margins") are played out in the rendering of the page.

About your question:

An [input type=submit] outside of a form will do nothing. If you want a button outside a form, you might try playing with "type=button" and see where that gets ya. You'll probably need to script a javascript action to make it do your nefarious bidding! ;-)

The other thing you might try is clearing the form's margin (by default, forms have noticeably large margins) and also try floating the FORM (ie, style="margin:0px;float:right;") or so....

Kirby L. Wallace
Ah but a table cant be voice read in proper order like you can do with a div ;)
Thqr
A: 

put each form in their own TD.

ex:

<table cellpadding="0" cellspacing="0">
<tr><td>
<form action="action.php" method="post" style="padding: 0; margin: 0">
<input type="submit" value="Submit" name="X1">
</form>
</td><td>
<form action="action.php" method="post" style="padding: 0; margin: 0">
<input type="submit" value="Submit" name="X2">
</form>
</td></tr></table>

etc

Debauchery42