?
Solved

how can you avoid this to happend?

Posted on 2004-04-01
14
Medium Priority
?
165 Views
Last Modified: 2010-08-05
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
0
Comment
Question by:alain123
[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
  • 3
  • 3
  • +2
14 Comments
 
LVL 17

Expert Comment

by:dorward
ID: 10738530
By placing wrapable characters in the "word" so the browser has somewhere to wrap it.

(The usual complaint it 'but its user submitted data' - sanity check the data in your server side script and return it to the user with an error if any word is too long)

In theory you could also use a soft hyphan, but browser support sucks. http://www.cs.tut.fi/~jkorpela/shy.html
0
 
LVL 11

Expert Comment

by:Sven
ID: 10739298
or use <wbr> after some characters! <wbr> will put line break if word is too long to display in one line!
0
 
LVL 17

Expert Comment

by:dorward
ID: 10739309
<wbr> is non-standard and depends on browsers error correction.

Depending on error correction is never a good idea, so <wbr> should be avoided.
0
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!

 
LVL 1

Author Comment

by:alain123
ID: 10740311
ok, but how do you control this on the html? not on the user level...
0
 
LVL 11

Expert Comment

by:Sven
ID: 10740349
These long words are happening by posting some data, right? So there must be any script that gets the post and put it to a database or s.th. like that. There you have to do the work!
0
 
LVL 17

Expert Comment

by:dorward
ID: 10740357
You don't control it in the HTML, you control it before, or while, the HTML is being written/generated.
0
 
LVL 1

Author Comment

by:alain123
ID: 10745788
hi dor, so how do you control a user who wants to break your tables by posting those characters?  he's not going to take care of the wrapping..

0
 
LVL 17

Expert Comment

by:dorward
ID: 10746549
The specifics depend on the language you are using. An example in Perl:

#!/usr/bin/perl
                                                                                                                 
my $bar = "asd";
my $foo = "qwertyuiopasdfghjklzxcvbnmisjdhfuwehonxcoincduisbieumodsmfuidsbfuierbfuisdnosdmgnfs";
if ($foo =~ /[\S-]{20,}/) {
   $error = true;
   print "You have a string of 20 or more characters unbroken by white space (i.e. a very long word).";
   print "This is not allowed, please edit your submission and try again.";
}
                                                                                                                 
if ($error) {
  showFormAgain();
} else {
  processData();
}
~
0
 
LVL 6

Accepted Solution

by:
bvinson earned 750 total points
ID: 10748498
alain,

I think what most people are trying to say here is that in HTML, there is no way to control user input.

What you have to do is take control back if the user does something deliberate (such as your example above).
In order to take back control you'll needs to use some scripting language to validate the user input - how you do this / what scripting language you use is up to you.

Essentially, you want to make sure that its valid input and whatever method you choose should allow the flexibility for actual input while weeding out bad input.

The only real way I can think of in pure HTML is to put MAXLENGTH on your textbox(es) or textarea(s), but this might limit a valid input as well.

ASP, JSP, Perl, even Javascript validations should all work to help you make the "sanity check" dorward is talking about.

bvinson
0
 
LVL 1

Author Comment

by:alain123
ID: 10749292
ok so there is no way to control whis unless you trim it behind the scenes... really surprises me..
0
 
LVL 6

Expert Comment

by:bvinson
ID: 10749316
Remember, HTML is only a formatting mark-up.  To call it a language is to give it more credit than it deserves.

It has come a long way over the years, but it is still a method for formatting rather than manipulating input.

Sorry you weren't able to find a way to do what you wanted to do, but some times "no" is a valid answer to a question.  (Not intended as a jab.)

bvinson
0
 
LVL 1

Expert Comment

by:thurston_l
ID: 10753334
and in css?
overflow: hidden?
0
 
LVL 1

Expert Comment

by:thurston_l
ID: 10753368
it seems to hide the overflow, but does it pushes anything rightwards?
0

Featured Post

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

762 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