From 6f622105dc8506cd3d95643f193df3280f45b9be Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 1 Aug 2012 14:23:18 +0100 Subject: [PATCH] Min lengths are only enforced when field is required. --- Block.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Block.pm b/Block.pm index 5edc887..f14f7e8 100644 --- a/Block.pm +++ b/Block.pm @@ -202,7 +202,7 @@ sub validate_string { # Is the string too short? If so, store it and return an error. return ($text, $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_TOOSHORT", "", {"***field***" => $settings -> {"nicename"}, "***minlen***" => $settings -> {"minlen"}})) - if($settings -> {"minlen"} && (length($text) < $settings -> {"minlen"})); + if($settings -> {"required"} && $settings -> {"minlen"} && (length($text) < $settings -> {"minlen"})); # Get here and all the tests have been passed or skipped return ($text, undef); @@ -309,7 +309,7 @@ sub validate_htmlarea { # Is the string too short? If so, store it and return an error. return ($text, $self -> {"template"} -> replace_langvar("BLOCK_VALIDATE_TOOSHORT", "", {"***field***" => $settings -> {"nicename"}, "***minlen***" => $settings -> {"minlen"}})) - if($settings -> {"minlen"} && (length($nohtml) < $settings -> {"minlen"})); + if($settings -> {"required"} && $settings -> {"minlen"} && (length($nohtml) < $settings -> {"minlen"})); # Now we get to the actual validation and stuff. Begin by scrubbing any tags # and other crap we don't want out completely. As far as I can tell, this should