I'm trying to make a forum and I have a problem. How can I make a word length limit?So you can't post a word with 32+ characters.
Asked
Active
Viewed 131 times
4 Answers
2
Use a css property
word-break: break-all;
say your word was saved with the tags
In the css file you should do this
p {
word-break: break-all;
}
Basically this means that a word can break even though two letters are consecutive so this:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Would become this: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Eujinks
- 390
- 1
- 16
0
You can do it by setting the max-length value in a form like this:
<form action="demo_form.asp">
Username: <input type="text" name="usrname" maxlength="10"><br>
<input type="submit" value="Submit">
</form>
See here for more info on form length and php.

Celt
- 2,469
- 2
- 26
- 43
-
That's not what I'm looking for ;/ I don't wanna limit the post, I want to limit the characters in a word. So you can't post a word like this (AAAAAAAAAAAFAFSFHASJHFASKJFSHGAGFSAFJSAGFJSAGFJSGAFSGAFJSAGFSJAGF) , because it has more than 32 characters. – tsvmitev Oct 23 '14 at 15:00
0
In plain HTML???
<textarea maxlength="32"></textarea>
you can use Javascript to count number of characters that are in the textarea.
here is something similar using jQuery Count characters in textarea
0
You can for example explode()
the post into words and use count()
on each of them to get their length, but what is the point?

Rafał Swacha
- 482
- 2
- 6
- 20
-
Ok I'll try this and I need it because see what's happening if there's no word length limit : http://i.imgur.com/UBKUKdP.jpg – tsvmitev Oct 23 '14 at 15:22