[Solar-svn] Revision 2629

pmjones at solarphp.com pmjones at solarphp.com
Wed Jul 25 21:57:08 CDT 2007


Solar_Form: [CHG] In populate(), do not set values for "submit", "button", or "reset" elements.  This keeps values from previous submit buttons from overwriting those on new forms.


Modified: trunk/Solar/Form.php
===================================================================
--- trunk/Solar/Form.php	2007-07-25 16:04:29 UTC (rev 2628)
+++ trunk/Solar/Form.php	2007-07-26 02:57:08 UTC (rev 2629)
@@ -866,7 +866,16 @@
         } else {
             // populate an element value, but only if it exists.
             if (isset($this->elements[$elem])) {
-                $this->elements[$elem]['value'] = $src;
+                
+                // do not populate certain elements, as this will
+                // reset their value inappropriately.
+                $skip = $this->elements[$elem]['type'] == 'submit' ||
+                        $this->elements[$elem]['type'] == 'button' ||
+                        $this->elements[$elem]['type'] == 'reset';
+                        
+                if (! $skip) {
+                    $this->elements[$elem]['value'] = $src;
+                }
             }
         }
     }




More information about the Solar-svn mailing list