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 5994 Jul 11, 2001, 4:50 AM
Thread Re: Formatting question
Paul 5887 Jul 11, 2001, 6:11 AM
Thread Re: Formatting question
eric74 5889 Jul 11, 2001, 7:55 AM
Thread Re: Formatting question
Paul 5888 Jul 11, 2001, 8:15 AM
Thread Re: Formatting question
AstroBoy 5896 Jul 11, 2001, 8:13 PM
Thread Re: Formatting question
eric74 5854 Jul 30, 2001, 2:40 PM
Thread Re: Formatting question
Paul 5835 Jul 30, 2001, 6:32 PM
Thread Re: Formatting question
lanerj 5819 Jul 31, 2001, 4:46 AM
Thread Re: Formatting question
Paul 5809 Jul 31, 2001, 5:05 AM
Post Re: Formatting question
lanerj 5797 Jul 31, 2001, 5:46 AM
Post Re: Formatting question
eric74 5799 Jul 31, 2001, 2:40 PM
Post Re: Formatting question
eric74 5797 Jul 31, 2001, 2:44 PM