diff options
-rw-r--r-- | HISTORY | 9 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TBaseValidator.php | 8 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TCustomValidator.php | 25 |
3 files changed, 33 insertions, 9 deletions
@@ -25,9 +25,11 @@ BUG: Ticket#908 - TDbCache::init / Exception (Knut) BUG: Ticket#922 - Problem with TUrlMapping and urlencoding (Michael) BUG: Ticket#938 - TPageStateFormatter EnableStateEncryption causes massive page state (Michael) BUG: Ticket#942 - MultiLine TInplaceTextBox (Christophe) +BUG: Ticket#38 - (trac:835) TValidationSummary, works different when it's showing Javascript Validation than Server Validation (Carl) CHG: Ticket#844 - Upgraded TinyMCE to 3.1.0.1 (Christophe) CHG: Ticket#917 - TUrlMapping - change members to protected (Michael) CHG: Ticket#919 - TUserManager loadUserData function (Michael) +CHG: Ticket#39 - Implement validator not requiring ControlToValidate (Carl) ENH: Workaround for slow meta data retrieval in MySQL<5.1.21 (Michael) ENH: Ticket#756 - TDateFormat & TNumberFormat - allow settings default text when Value isn't set. (Carl) ENH: Ticket#823 - PromptText/PromptValue only populated if there is data (Knut) @@ -46,6 +48,9 @@ ENH: Ticket#911 - prado-cli: Better error message if database connection fails w ENH: Ticket#913 - PRADO Copyright notice in HTML source (Carl) ENH: Ticket#925 - TTimeTriggeredCallback update interval during callback (Brad, Christophe) ENH: Ticket#941 - Add addRoute() method to TLogRouter (Michael) +ENH: Ticket#46 - TColorPicker - Output is missing alt tag (Carl) +ENH: Ticket#32 - (trac:861) Implement ability to specify default service ID (Carl) +ENH: Ticket#31 - (trac:867) Consider UTF MessageSource_XLIFF class file (Carl) NEW: Added Prado.Validation.validateControl(id) on client side to validate a specific control (Michael) NEW: Added MessageSource_Database to I18N (uses TDbConnection) (Michael) NEW: Ticket#790 - Added TActiveFileUpload (Bradley, Christophe) @@ -53,10 +58,6 @@ NEW: Ticket#935 - Added TActiveDatePicker (Bradley, Christophe) NEW: Ticket#857 - Added Authentication expiration support to TAuthManager (Michael) NEW: Ticket#853 - Added Drag and drop components (Christophe) NEW: Ticket#891 - Added method that returns table name to TActiveRecord (Michael) -BUG: Ticket#38 - (trac:835) TValidationSummary, works different when it's showing Javascript Validation than Server Validation (Carl) -ENH: Ticket#32 - (trac:861) Implement ability to specify default service ID (Carl) -ENH: Ticket#31 - (trac:867) Consider UTF MessageSource_XLIFF class file (Carl) -ENH: Ticket#46 - TColorPicker - Output is missing alt tag (Carl) Version 3.1.2 April 21, 2008 ============================ diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index 56239bcb..b418885c 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -496,7 +496,7 @@ abstract class TBaseValidator extends TLabel implements IValidator $this->setIsValid(true); $this->onValidate(); if($this->getVisible(true) && $this->getEnabled(true)) - { + { // if the target is not a disabled web control if(($target=$this->getValidationTarget())!==null && !($target instanceof TWebControl && !$target->getEnabled(true))) { @@ -512,6 +512,12 @@ abstract class TBaseValidator extends TLabel implements IValidator $this->onValidationError(); } } + else + { + $this->evaluateIsValid(); + $this->setIsValid(true); + $this->onValidationSuccess(); + } } return $this->getIsValid(); } diff --git a/framework/Web/UI/WebControls/TCustomValidator.php b/framework/Web/UI/WebControls/TCustomValidator.php index fe540c80..0b82ac5c 100644 --- a/framework/Web/UI/WebControls/TCustomValidator.php +++ b/framework/Web/UI/WebControls/TCustomValidator.php @@ -4,7 +4,7 @@ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -88,7 +88,9 @@ class TCustomValidator extends TBaseValidator */
public function evaluateIsValid()
{
- $value=$this->getValidationValue($this->getValidationTarget());
+ $value = '';
+ if($this->getValidationTarget()!==null)
+ $value=$this->getValidationValue($this->getValidationTarget());
return $this->onServerValidate($value);
}
@@ -105,9 +107,24 @@ class TCustomValidator extends TBaseValidator {
$param=new TServerValidateEventParameter($value,true);
$this->raiseEvent('OnServerValidate',$this,$param);
- return $param->getIsValid();
+ if($this->getValidationTarget()==null)
+ return true;
+ else
+ return $param->getIsValid();
+ }
+
+ /**
+ * @return TControl control to be validated. Null if no control is found.
+ */
+ protected function getValidationTarget()
+ {
+ if(($id=$this->getControlToValidate())!=='' && ($control=$this->findControl($id))!==null)
+ return $control;
+ else if(($id=$this->getControlToValidate())!=='')
+ throw new TInvalidDataTypeException('basevalidator_validatable_required',get_class($this));
+ else
+ return null;
}
-
/**
* Returns an array of javascript validator options.
|