• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

how can you avoid this to happend?

mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
0
alain123
Asked:
alain123
  • 4
  • 3
  • 3
  • +2
1 Solution
 
dorwardCommented:
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
 
SvenCommented:
or use <wbr> after some characters! <wbr> will put line break if word is too long to display in one line!
0
 
dorwardCommented:
<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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
alain123Author Commented:
ok, but how do you control this on the html? not on the user level...
0
 
SvenCommented:
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
 
dorwardCommented:
You don't control it in the HTML, you control it before, or while, the HTML is being written/generated.
0
 
alain123Author Commented:
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
 
dorwardCommented:
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
 
bvinsonCommented:
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
 
alain123Author Commented:
ok so there is no way to control whis unless you trim it behind the scenes... really surprises me..
0
 
bvinsonCommented:
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
 
thurston_lCommented:
and in css?
overflow: hidden?
0
 
thurston_lCommented:
it seems to hide the overflow, but does it pushes anything rightwards?
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 4
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now