Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

keeping <form> from making line break 2

Status
Not open for further replies.

occas

Technical User
Jan 14, 2004
164
US
is there a way to keep a line break from occurring after a <form> tag?

ty.
 
If you use tables you can do this too.
<table>
<form>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</form>[\b]
</table>

thereptilian120x120.gif
 
bombboy,

The &quot;table&quot; element may directly contain only the following elements: &quot;tr&quot;, &quot;thead&quot;, &quot;tbody&quot;, &quot;tfoot&quot;, &quot;col&quot;, &quot;colgroup&quot;, &quot;caption&quot;. The &quot;form&quot; element is not allowed after a there.

I'd go with the padding / margin option suggested by Dan - but unfortunately, I think it has problems in Netscape 4.x (from what I've tested in the past).

Pete.


Web Developer / Aptrix CMS (LWWCM) Specialist
w: e: Pete.Raleigh(at)lclimited.co.uk
 
BillyRay's and Bombboy's solutions will both stop extra whitespace being displayed before/after the form (though Dan's approach is much better), but neither will stop the line break altogether as requested in the question. Try this instead:
[tt]
<form style=&quot;display: inline&quot;>
[/tt]

-- Chris Hunt
 
QUOTE: The &quot;table&quot; element may directly contain only the following elements: &quot;tr&quot;, &quot;thead&quot;, &quot;tbody&quot;, &quot;tfoot&quot;, &quot;col&quot;, &quot;colgroup&quot;, &quot;caption&quot;. The &quot;form&quot; element is not allowed after a there.

That is misleading. bombboy's solution is perfectly valid and works in older browsers, regardless of what documentation tells you.

Removing the FORM from display by nesting it in regions that are not displayed is the solution I have always used, and <TABLE><FORM><TR>...</TR></FORM></TABLE> is a favourite.

----------
I'm willing to trade custom scripts for... [see profile]
 

>> bombboy's solution is perfectly valid

Does it validate against any of the HTML / XHTML DTDs? I've not tried validating it myself, but I've always thought it very bad programming practice to place a form tag within a table, unless inside a TD itself.

Dan
 
Define &quot;better&quot;?

Personally, I would prefer a solution that worked in all browsers :)

---

Does it validate against any of the HTML / XHTML DTDs?

Never checked. But seems a mute point to me, does code that validates against HTML DTDs always look the same in every browser? :)

----------
I'm willing to trade custom scripts for... [see profile]
 
What I mean is, if it stopped working in IE7 or NS9 then I would not complain because the &quot;feature&quot; was never a specified standard.

However, for as long as it happens to be the &quot;most compatible&quot; solution I really don't care what W3C have to say on the matter.

Ultimately the objective is to use universal code. DTDs may help to standardise the industry but if sticking to them isn't the most universal solution then they can be sidelined.

----------
I'm willing to trade custom scripts for... [see profile]
 
It's a valid solution in the sense that it works in current browsers

I use that method for the simple fact that I know it works in older browsers where css isn't supported or has buggy support, not just current browsers. Yes those browsers are becomming fewer and farther between, but for some ungodly reason some people still prefer ns4 over the later browsers of any make or model. I know two people myself who refuse to upgrade. not to mention some government fasilities (such as a good part of the navy) still use NS4.7 as the standard browser.

[The following is my opinion you can agree or not]

If you're making a site that is fun for you and it's just &quot;my little spot on the web&quot;, or a company intranet, or basicly anywhere you know you have a fixed userbase with known browser settings, conforming to all these standars is great and grand, but when you're out to make money, you don't want to elminiate any of your customer base no matter how small. that includes ignorant users of old browsers.

I'm not opposed to CSS or xhtml at all, I make my best attempt at both in my own time on my own site. but when I work for clients that are trying to sell/present products to customers, I try to stick to the basics.

To non-web savvy customers they don't care about CSS/(X)HTML standards. presentation is everything, If images overlap text, buttons don't appear, text appears when unwanted... whatever... if it doesn't look right because you've excluded coding for them you've lost a sale.

wouldn't it be nice if we could start the again and only allow WEB STANDARD COMPLIANT BROWSERS to access it?


thereptilian120x120.gif
 
QUOTE: &quot;wouldn't it be nice if we could start the again and only allow WEB STANDARD COMPLIANT BROWSERS to access it?&quot;

Having started with one standard wouldn't mean different developers couldn't interpret those standards differently - as has happened on a number of occations and will continue to happen ;)

----------
I'm willing to trade custom scripts for... [see profile]
 

In older browsers, I got around the issue by including the open form tag right after the open body tag, and the close form tag right before the close body tag... Always worked for me in pre-css days

>> But seems a mute point to me
Yeah - don't you just hate those points that don't say anything? ;o)

Dan

 
&quot;I would prefer a solution that worked in all browsers&quot;

Have you tested your solution in all of them? Can you be sure that some don't choke on finding a <form> where they expect a <tr>?


&quot;does code that validates against HTML DTDs always look the same in every browser?&quot;

No. Nor does manky old HTML tag soup. The point of validating your pages is not the futile pursuit of total uniformity across browsers, nor for the feeling of smug satisfaction that you get from having a &quot;valid&quot; site. It's a quality control thing. If my pages validate, I know they aren't going to be screwed up because of some minor syntax error in the markup. Of course there's more to producing quality code than that, but if you can automate the process of finding silly mistakes, it leaves you more time to deal with the major ones (not that I ever make any, of course :) ).


&quot;when you're out to make money, you don't want to elminiate any of your customer base no matter how small&quot;

Not necessarily, sometimes it costs more to support old customers than you can make from them. Try getting parts for a Model T from your local Ford dealership! Some big web sites have decided that the savings they make from web standards outweigh the downside, see this interview with a designer at ESPN: .


&quot;wouldn't it be nice if we could start the again and only allow WEB STANDARD COMPLIANT BROWSERS to access it?&quot;

Maybe, though perhaps the forgiving nature of browsers has encouraged the internet to grow further and faster than it might otherwise have done. This point really is moot.

In any case, who's talking about excluding non-compliant browsers? Use the CSS solution and browsers that don't understand it will just display a little extra whitespace around the form. Big deal. The page will still be usable, just less pretty (maybe). Many NS4 users won't even notice(not that there are many NS4 users).

-- Chris Hunt
 
I totaly understand and am not arguing in anyway.

A very good article.
I have to admit I do agree with his views on validation.

Like I said I'm not against standards in anyway. Unfortunatly I don't think all my customers combined get 1 billion hits a day providing enough clout to say &quot;Hey jerk go upgrade&quot; (so to speak)
I don't imagine any of us here do. :)

&quot;when you're out to make money, you don't want to elminiate any of your customer base no matter how small&quot;
When you're a small work at home biz that might get 100 to 1000 views per month, you really can't afford to exclude 2 - 20 of those hits especially when even one may be a large buying customer. I don't mean exclude as redirect to a &quot;You suck&quot; page, I mean when the whole site is in divs and overlapping and you can't make heads or tails of what is on the page. &quot;i'll go look elsewhere&quot;

&quot;...sometimes it costs more to support old customers than you can make from them. Try getting parts for a Model T from your local Ford dealership!&quot;
- at this point in time (I'm sure not in the future) it is easier and usualy cheaper to find a i-know-how-to-use-frontpage-themes web designer that can design in run of the mill &quot;old school&quot; html or even allow the site owner to make his/her own minor changes to layout without having to understand how to read css. some small home biz's make there own webpage with no web experience at all because of the ease of use of html. although css is better for layout and arguably better for file size not as easy to understand for the simple folks trying to make a buck selling home made sweaters and jam with low over head and no IT understanding.

I'm all for forward development of the web and i'm keeping up to the best of my ability, &quot;not skeered&quot;. I'm just saying that some people can't drop the 4th gen browser &quot;security blanket&quot; especially for the non web-dev savvy home biz folks, which are my primary staple. :)

thereptilian120x120.gif
 
I haven't really made the plunge into CSS-based layout yet myself. Supporting older browsers is part of the issue, retaining my sanity is the main constraint! When/if I make that jump I'll be careful to ensure that the site doesn't degrade into something that's &quot;overlapping and you can't make heads or tails of what is on the page&quot; for browsers that can't handle it.

But that's not the issue here. Here we're just talking about a little whitespace around a form. It's not likely to be a critical failure if there's an extra gap around the form on a handful of browsers - so it's a price I'm willing to pay to get a page that validates. Pretty for new browsers, usable for old ones, that's my rule!

-- Chris Hunt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top