Solved

how can you avoid this to happend?

Posted on 2004-04-01
14
158 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
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 …

920 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

17 Experts available now in Live!

Get 1:1 Help Now