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

Diff of /nfo/php/libs/com.newsblob.phphtmllib/form/form_elements/FEDataList.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.2 by jonen, Sat Sep 20 00:20:15 2003 UTC
# Line 44  class FEDataList extends FEBoxElement { Line 44  class FEDataList extends FEBoxElement {
44       */       */
45      function FEDataList($label, $required = TRUE, $width = NULL, $height = NULL, $data_list = array()) {      function FEDataList($label, $required = TRUE, $width = NULL, $height = NULL, $data_list = array()) {
46          $this->FEBoxElement($label, $required, $width, $height);          $this->FEBoxElement($label, $required, $width, $height);
47            $this->set_list_data( $data_list );
48        }
49    
50        /**
51         * This function sets the array of data
52         * to be used in the data list
53         *
54         * @param array data_list - list of data elements (name=>value)
55         */
56        function set_list_data( $data_list = array() ) {
57          $this->_data_list = $data_list;          $this->_data_list = $data_list;
58      }      }
59    
# Line 63  class FEDataList extends FEBoxElement { Line 73  class FEDataList extends FEBoxElement {
73       */       */
74      function get_value_text($value) {      function get_value_text($value) {
75          $flip = array_flip($this->_data_list);          $flip = array_flip($this->_data_list);
76          return $flip[$value];          if (array_key_exists($value, $flip)) {
77                return $flip[$value];
78            } else {
79                return NULL;
80            }
81      }      }
82    
83      /**      /**
# Line 72  class FEDataList extends FEBoxElement { Line 86  class FEDataList extends FEBoxElement {
86       * validation and setting the appropriate error message       * validation and setting the appropriate error message
87       * in case of a failed validation       * in case of a failed validation
88       *       *
89         * @param FormValidation object
90       */       */
91      function validate() {      function validate(&$_FormValidation) {
92          // we make sure that the value is in the data list          // we make sure that the value is in the data list
93          $values = $this->get_value();          $values = $this->get_value();
94          if (is_array($values) ) {          if (is_array($values) ) {

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

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