logo       

cvs: pear /HTML_QuickForm/QuickForm checkbox.php: msg#00451

Subject: cvs: pear /HTML_QuickForm/QuickForm checkbox.php
mansion         Tue Oct 29 11:29:28 2002 EDT

  Modified files:              
    /pear/HTML_QuickForm/QuickForm      checkbox.php 
  Log:
  With changes in element.php about submitted values, value was not been set 
correctly. Fixed.
  
  
Index: pear/HTML_QuickForm/QuickForm/checkbox.php
diff -u pear/HTML_QuickForm/QuickForm/checkbox.php:1.4 
pear/HTML_QuickForm/QuickForm/checkbox.php:1.5
--- pear/HTML_QuickForm/QuickForm/checkbox.php:1.4      Tue Jun  4 20:01:47 2002
+++ pear/HTML_QuickForm/QuickForm/checkbox.php  Tue Oct 29 11:29:27 2002
@@ -17,7 +17,7 @@
 // |          Bertrand Mansion <bmansion@xxxxxxxxxxx>                     |
 // +----------------------------------------------------------------------+
 //
-// $Id: checkbox.php,v 1.4 2002/06/05 00:01:47 jrust Exp $
+// $Id: checkbox.php,v 1.5 2002/10/29 16:29:27 mansion Exp $
 
 require_once("HTML/QuickForm/input.php");
 
@@ -39,7 +39,7 @@
      * @since     1.1
      * @access    private
      */
-    var $_text = "";
+    var $_text = '';
 
     // }}}
     // {{{ constructor
@@ -48,7 +48,8 @@
      * Class constructor
      * 
      * @param     string    $elementName    (optional)Input field name 
attribute
-     * @param     string    $value          (optional)Input field value
+     * @param     string    $elementLabel   (optional)Input field value
+     * @param     string    $text           (optional)Checkbox display text
      * @param     mixed     $attributes     (optional)Either a typical HTML 
attribute string 
      *                                      or an associative array
      * @since     1.0
@@ -56,7 +57,7 @@
      * @return    void
      * @throws    
      */
-    function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, 
$text=null, $attributes=null)
+    function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, 
$text='', $attributes=null)
     {
         HTML_QuickForm_input::HTML_QuickForm_input($elementName, 
$elementLabel, $attributes);
         $this->_persistantFreeze = true;
@@ -227,10 +228,18 @@
             case 'addElement':
             case 'createElement':
                 $this->$className($arg[0], $arg[1], $arg[2], $arg[3]);
+                // need to set the submit value in case setDefault never gets 
called
+                $elementName = $this->getName();
+                if (count($caller->_submitValues) > 0) {
+                    
$this->setChecked(isset($caller->_submitValues[$elementName]));
+                }
                 break;
             case 'setDefault':
-                $vars = $caller->getSubmitValues();
-                if (count($vars) == 0) {
+                // In form display, default value is always overidden by 
submitted value
+                $elementName = $this->getName();
+                if (count($caller->_submitValues) > 0) {
+                    
$this->setChecked(isset($caller->_submitValues[$elementName]));
+                } else {
                     $this->setChecked($arg);
                 }
                 break;
@@ -242,9 +251,9 @@
             break;
         }
         return true;
-    } // end func onQuickFormLoad
+    } // end func onQuickFormEvent
 
     // }}}
 
 } //end class HTML_QuickForm_checkbox
-?>
+?>
\ No newline at end of file



-- 
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe