Solved

how can you avoid this to happend?

Posted on 2004-04-01
14
155 Views
Last Modified: 2010-08-05
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
0
Comment
Question by:alain123
  • 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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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 250 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
 
LVL 1

Expert Comment

by:thurston_l
ID: 10755422
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Suggestion on WebSite Template Sites 5 51
Hover Gone 16 30
Urgent Help with HTML CSS Positioning 9 20
Bootstap Icons 3 19
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
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 …

707 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

13 Experts available now in Live!

Get 1:1 Help Now