From c5b2785e82ed2bf914e7df3107373e24098df794 Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 25 Jul 2016 16:53:19 +1000 Subject: [PATCH] Added textarea with auto calc --- classes/lnApp/Form.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/classes/lnApp/Form.php b/classes/lnApp/Form.php index f7035a0..5f43cd0 100644 --- a/classes/lnApp/Form.php +++ b/classes/lnApp/Form.php @@ -177,5 +177,16 @@ parserRules: { public static function textarea_rows($textarea,$min=10,$char="\n") { return ($x=count(explode($char,$textarea))) < $min ? $min : $x; } + + public static function textarea_width($textarea,$min=76,$char="\n") { + $x = $min; + foreach (explode($char,$textarea) as $string) + { + if (strlen($string) > $x) + $x = strlen($string); + } + + return $x; + } } ?>