/[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.2 - (hide annotations)
Sat Sep 20 00:20:15 2003 UTC (21 years ago) by jonen
Branch: MAIN
Changes since 1.1: +65 -1 lines
+ updated whole phphtmllib to v2.3.0

1 jonen 1.1 <?php
2     /**
3     * This file contains the Text FormElement class.
4     *
5 jonen 1.2 * $Id: FETextArea.inc,v 1.5 2003/06/02 20:17:47 hemna Exp $
6 jonen 1.1 *
7     * @author Walter A. Boring IV <waboring@buildabetterweb.com>
8     * @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     * @author Walter A. Boring IV <waboring@buildabetterweb.com>
22     * @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     * This function will return the
78     * elements value
79     *
80     * @return mixed
81     */
82     function get_value() {
83     if ($this->_limit_char_count < 0) {
84     return $this->_value;
85     } else {
86     return substr($this->_value, 0, $this->_limit_char_count);
87     }
88    
89     }
90    
91    
92     /**
93     * This method is used as a shortcut
94     * to set the rows attribute
95     *
96     * @param int the rows attribute value
97     */
98     function set_rows( $rows ) {
99     $this->set_attribute("rows", $rows);
100     }
101    
102     /**
103     * This method is used as a shortcut
104     * to set the cols attribute
105     *
106     * @param int the cols attribute value
107     */
108     function set_cols( $cols ) {
109     $this->set_attribute("cols", $cols);
110 jonen 1.1 }
111    
112     }
113     ?>

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