From 7791b8dcfe1c330c58b3ed3913385321f074b13b Mon Sep 17 00:00:00 2001 From: phpnut Date: Wed, 6 Jul 2005 03:03:54 +0000 Subject: [PATCH] Added validation check to areaTag() with patch from Ticket #54 submitted by bgmccollum. Note this will not work with the current Blog tutorial. https://trac.cakephp.org/wiki/Cake/Tutorials/BlogPosts We will update the tutorial with this change in next release. Closes #54 Thanks bgmccollum git-svn-id: https://svn.cakephp.org/repo/trunk/cake@335 3807eeeb-6ff5-0310-8944-8be069107fe0 --- libs/helpers/html.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libs/helpers/html.php b/libs/helpers/html.php index 4b2f579e793..a15a831cd89 100644 --- a/libs/helpers/html.php +++ b/libs/helpers/html.php @@ -295,13 +295,16 @@ function fileTag($tag_name, $html_options=null) * @param array $html_options * @return string */ - function areaTag($tag_name, $cols=60, $rows=10, $html_options=null) - { - $value = empty($html_options['value'])? $this->tagValue($tag_name): empty($html_options['value']); - $html_options['cols'] = $cols; - $html_options['rows'] = $rows; - return sprintf(TAG_AREA, $tag_name, $this->parseHtmlOptions($html_options, null, ' '), $value); - } + function areaTag($tag_name, $cols=60, $rows=10, $html_options=null) + { + $elements = explode("/", $tag_name); + + $value = empty($html_options['value'])? $this->tagValue($elements[1]): empty($html_options['value']); + $html_options['cols'] = $cols; + $html_options['rows'] = $rows; + $this->tagIsInvalid($elements[0],$elements[1])? $html_options['class'] = 'form_error': null; + return sprintf(TAG_AREA, $elements[1], $this->parseHtmlOptions($html_options, null, ' '), $value); + } /** * Returns an INPUT element with type="checkbox". Checkedness is to be passed as string "checked" with the key "checked" in the $html_options array.