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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Thu Aug 11 14:09:59 2005 UTC (19 years ago) by jonen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +3 -3 lines
+ updated to version 2.5.3

1 jonen 1.1 <?php
2     /**
3     * This file contains the Text FormElement class.
4     *
5 jonen 1.4 * $Id: FETextArea.inc,v 1.7.2.1 2005/05/12 01:24:03 hemna Exp $
6 jonen 1.1 *
7 jonen 1.4 * @author Walter A. Boring IV <waboring@newsblob.com>
8 jonen 1.1 * @author Suren Markosyan <suren@bcsweb.com>
9     * @package phpHtmlLib
10     * @subpackage FormProcessing
11     *
12     * @copyright LGPL - See LICENCE
13     *
14     */
15    
16     /**
17     * This is the TextArea FormElement which builds a
18     * textarea field. It has no validation method.
19     *
20     *
21 jonen 1.4 * @author Walter A. Boring IV <waboring@newsblob.com>
22 jonen 1.1 * @author Suren Markossian <suren@bcsweb.com>
23     * @package phpHtmlLib
24     * @subpackage FormProcessing
25     *
26     * @copyright LGPL - See LICENCE
27     */
28     class FETextArea extends FEBoxElement {
29    
30 jonen 1.2
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 jonen 1.1 /**
58     * This function builds and returns the
59     * form element object
60     *
61     * @return object
62     */
63     function get_element() {
64    
65     $attributes = $this->_build_element_attributes();
66    
67     $tag = new TEXTAREAtag($attributes);
68    
69     if (($value = $this->get_value()) != NULL)
70     $tag->add($value);
71    
72     return $tag;
73 jonen 1.2 }
74    
75    
76     /**
77 jonen 1.3 * This method validates the data
78     * for this Form Element.
79 jonen 1.2 *
80 jonen 1.3 * It validates as is_name().
81     * @param FormValidation object.
82 jonen 1.2 */
83 jonen 1.3 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 jonen 1.2 }
94 jonen 1.3 return TRUE;
95 jonen 1.2 }
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 jonen 1.1 }
117    
118     }
119     ?>

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