/[cvs]/nfo/php/libs/com.newsblob.phphtmllib/form/form_elements/FETextArea.inc
ViewVC logotype

Diff of /nfo/php/libs/com.newsblob.phphtmllib/form/form_elements/FETextArea.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by jonen, Sat Feb 22 21:07:48 2003 UTC revision 1.3 by jonen, Thu May 6 16:27:27 2004 UTC
# Line 27  Line 27 
27   */   */
28  class FETextArea extends FEBoxElement {  class FETextArea extends FEBoxElement {
29    
30    
31        /**
32         * The constructor
33         *
34         * @param label string - text label for the element
35         * @param bool required - is this a required element
36         * @param int required - the rows attribute
37         * @param int required - the cols attribute
38         * @param int optional - element width in pixels (px), percentage (%) or elements (em)
39         * @param int optional - element height in pixels (px), percentage (%) or elements (em)    
40         * @param int optional - the number of characters to limit the value to.
41         */
42        function FETextArea($label, $required = TRUE, $rows, $cols, $width = NULL, $height = NULL,
43                            $limit_char_count=-1 ) {        
44            $this->_limit_char_count = $limit_char_count;
45            $this->FEBoxElement($label, $required, $width, $height);
46            $this->set_rows( $rows );
47            $this->set_cols( $cols );
48        }
49    
50    
51        /**
52         * This lets you limit the amount of data to
53         * accept in the field
54         */
55        var $_limit_char_count = -1;
56    
57      /**      /**
58       * This function builds and returns the       * This function builds and returns the
59       * form element object       * form element object
# Line 45  class FETextArea extends FEBoxElement { Line 72  class FETextArea extends FEBoxElement {
72          return $tag;          return $tag;
73      }      }
74    
75    
76        /**
77         * This method validates the data
78         * for this Form Element.
79         *
80         * It validates as is_name().
81         * @param FormValidation object.
82         */
83        function validate(&$_FormValidation) {
84            if ($this->_limit_char_count > 0) {
85                $length = strlen($this->get_value());
86                if ($length > $this->_limit_char_count) {
87                    $_FormValidation->_error("INVALID_LENGTH_N");
88                    $this->set_error_message( str_replace(array("XX_MAX", "XX_LENGTH"),
89                                                          array($this->_limit_char_count, $length),
90                                                          $_FormValidation->get_error_message() ));
91                    return FALSE;
92                }
93            }
94            return TRUE;
95        }
96    
97    
98        /**
99         * This method is used as a shortcut
100         * to set the rows attribute
101         *
102         * @param int the rows attribute value
103         */
104        function set_rows( $rows ) {
105            $this->set_attribute("rows", $rows);
106        }
107    
108        /**
109         * This method is used as a shortcut
110         * to set the cols attribute
111         *
112         * @param int the cols attribute value
113         */
114        function set_cols( $cols ) {
115            $this->set_attribute("cols", $cols);
116        }
117    
118  }  }
119  ?>  ?>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed