This will stop anyone from entering words that are longer than a set number of chars in length.
I found 25 to be ok. If the try and enter words that are longer then it will return an error.
The problem I found with trying to limit the length of the line is that lower case is shorter than upper case.
ie,
aaaaaawwwwwwmmmmmm
AAAAAAWWWWWWMMMMMM
therefore, 20 chars of upper case can be a lot longer than 20 of lower. This also applies to different fonts.
Put this at the top of sub validate_record in your db.cgi,
$descr = $in{'Description'};
$descr =~ s/\s+/ /g;
$descr =~ /^\s+(.+)$/ ? ($descr = $1) : ($descr = $descr);
@words = split(/\s/,$descr);
foreach (@words) {
unless ($_ =~ /^\S{1,25}$/) {
push(@input_err, "$col <font face=arial,verdana,helvetica,sans serif size=2
color=ce0000><b>You have words that are too long in your description field.
You are not allowed to enter words that are longer than 25 characters in length. Check
your Description field and shorten any words that are to long.</b>");
last;
}
}
Bob
http://totallyfreeads.com
I found 25 to be ok. If the try and enter words that are longer then it will return an error.
The problem I found with trying to limit the length of the line is that lower case is shorter than upper case.
ie,
aaaaaawwwwwwmmmmmm
AAAAAAWWWWWWMMMMMM
therefore, 20 chars of upper case can be a lot longer than 20 of lower. This also applies to different fonts.
Put this at the top of sub validate_record in your db.cgi,
$descr = $in{'Description'};
$descr =~ s/\s+/ /g;
$descr =~ /^\s+(.+)$/ ? ($descr = $1) : ($descr = $descr);
@words = split(/\s/,$descr);
foreach (@words) {
unless ($_ =~ /^\S{1,25}$/) {
push(@input_err, "$col <font face=arial,verdana,helvetica,sans serif size=2
color=ce0000><b>You have words that are too long in your description field.
You are not allowed to enter words that are longer than 25 characters in length. Check
your Description field and shorten any words that are to long.</b>");
last;
}
}
Bob
http://totallyfreeads.com