Gossamer Forum
Home : Products : DBMan : Discussions :

Re: Formatting question

Quote Reply
Re: Formatting question In reply to
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

Subject Author Views Date
Thread Formatting question eric74 4419 Jul 11, 2001, 4:50 AM
Thread Re: Formatting question
Paul 4344 Jul 11, 2001, 6:11 AM
Thread Re: Formatting question
eric74 4337 Jul 11, 2001, 7:55 AM
Thread Re: Formatting question
Paul 4345 Jul 11, 2001, 8:15 AM
Thread Re: Formatting question
AstroBoy 4355 Jul 11, 2001, 8:13 PM
Thread Re: Formatting question
eric74 4301 Jul 30, 2001, 2:40 PM
Thread Re: Formatting question
Paul 4279 Jul 30, 2001, 6:32 PM
Thread Re: Formatting question
lanerj 4264 Jul 31, 2001, 4:46 AM
Thread Re: Formatting question
Paul 4268 Jul 31, 2001, 5:05 AM
Post Re: Formatting question
lanerj 4254 Jul 31, 2001, 5:46 AM
Post Re: Formatting question
eric74 4248 Jul 31, 2001, 2:40 PM
Post Re: Formatting question
eric74 4257 Jul 31, 2001, 2:44 PM