cvs: pear /HTML_QuickForm QuickForm.php
| From: | Bertrand Mansion | Date: | Fri, 13 Dec 2002 23:16:00 +0000 |
| Subject: | cvs: pear /HTML_QuickForm QuickForm.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-7878@lists.php.net to get a copy of this message | ||
mansion Fri Dec 13 18:16:00 2002 EDT
Modified files:
/pear/HTML_QuickForm QuickForm.php
Log:
Fix bug spotted by Culley Harrelson. When using createElement, submitted values were not updated
in elements.
Index: pear/HTML_QuickForm/QuickForm.php
diff -u pear/HTML_QuickForm/QuickForm.php:1.46 pear/HTML_QuickForm/QuickForm.php:1.47
--- pear/HTML_QuickForm/QuickForm.php:1.46 Sun Dec 8 17:56:46 2002
+++ pear/HTML_QuickForm/QuickForm.php Fri Dec 13 18:16:00 2002
@@ -17,7 +17,7 @@
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
-// $Id: QuickForm.php,v 1.46 2002/12/08 22:56:46 mansion Exp $
+// $Id: QuickForm.php,v 1.47 2002/12/13 23:16:00 mansion Exp $
require_once('PEAR.php');
require_once('HTML/Common.php');
@@ -211,8 +211,8 @@
'minlength' =>array('regex',
'/^(\s|\S){%data%,}$/'),
'rangelength' =>array('regex',
'/^(\s|\S){%data%}$/'),
'regex' =>array('regex', '%data%'),
- 'email' =>array('regex',
'/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/'),
- 'emailorblank' =>array('regex',
'/(^$)|(^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$)/'),
+ 'email' =>array('regex',
'/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/'),
+ 'emailorblank' =>array('regex',
'/(^$)|(^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$)/'),
'lettersonly' =>array('regex', '/^[a-zA-Z]*$/'),
'alphanumeric' =>array('regex', '/^[a-zA-Z0-9]*$/'),
'numeric' =>array('regex',
'/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/'),
@@ -566,7 +566,10 @@
}
$elementName = $elementObject->getName();
$elementLabel = $elementObject->getLabel();
- if (isset($this->_defaultValues[$elementName])) {
+ $elementValue = null;
+ if (isset($this->_submitValues[$elementName])) {
+ $elementObject->onQuickFormEvent('setDefault',
$this->_submitValues[$elementName], $this);
+ } elseif (isset($this->_defaultValues[$elementName])) {
$elementObject->onQuickFormEvent('setDefault',
$this->_defaultValues[$elementName], $this);
}
if (isset($this->_constantValues[$elementName])) {