summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/TControl.php8
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php6
-rw-r--r--framework/Web/UI/WebControls/TCheckBox.php18
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxList.php18
-rw-r--r--framework/Web/UI/WebControls/TDropDownList.php18
-rw-r--r--framework/Web/UI/WebControls/TFileUpload.php19
-rw-r--r--framework/Web/UI/WebControls/THiddenField.php18
-rw-r--r--framework/Web/UI/WebControls/TListBox.php18
-rw-r--r--framework/Web/UI/WebControls/TTextBox.php18
9 files changed, 140 insertions, 1 deletions
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index 576db89b..1c03a04d 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -1997,6 +1997,14 @@ interface IValidatable
* @return mixed the value of the property to be validated.
*/
public function getValidationPropertyValue();
+ /**
+ * @return boolean wether this control's validators validated successfully (must default to true)
+ */
+ public function getIsValid();
+ /**
+ * @return boolean wether this control's validators validated successfully
+ */
+ public function setIsValid($value);
}
/**
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index add771cc..9a298adb 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -269,8 +269,11 @@ abstract class TBaseValidator extends TLabel implements IValidator
{
$class = preg_replace ('/ '.preg_quote($cssClass).'/', '',$control->getCssClass());
if(!$this->getIsValid())
+ {
$class .= ' '.$cssClass;
- $control->setCssClass($class);
+ $control->setCssClass($class);
+ } elseif ($control->getIsValid())
+ $control->setCssClass($class);
}
}
}
@@ -504,6 +507,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
}
else
{
+ $target->setIsValid(false);
$this->setIsValid(false);
$this->onValidationError();
}
diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php
index faff5086..d8c2cc0b 100644
--- a/framework/Web/UI/WebControls/TCheckBox.php
+++ b/framework/Web/UI/WebControls/TCheckBox.php
@@ -43,6 +43,7 @@
class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatable, IDataRenderer, ISurroundable
{
private $_dataChanged=false;
+ private $_isValid=true;
/**
* @return string tag name of the button
@@ -125,6 +126,23 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
return $this->getChecked();
}
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
/**
* @return string the text caption of the checkbox
*/
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php
index 1e1c3b10..7cabb356 100644
--- a/framework/Web/UI/WebControls/TCheckBoxList.php
+++ b/framework/Web/UI/WebControls/TCheckBoxList.php
@@ -53,6 +53,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
private $_isEnabled;
private $_changedEventRaised=false;
private $_dataChanged=false;
+ private $_isValid=true;
/**
* Constructor.
@@ -428,6 +429,23 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
return $this->getSelectedValue();
}
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
/**
* Gets the name of the javascript class responsible for performing postback for this control.
* This method overrides the parent implementation.
diff --git a/framework/Web/UI/WebControls/TDropDownList.php b/framework/Web/UI/WebControls/TDropDownList.php
index f00466d5..627646bb 100644
--- a/framework/Web/UI/WebControls/TDropDownList.php
+++ b/framework/Web/UI/WebControls/TDropDownList.php
@@ -40,6 +40,7 @@ Prado::using('System.Web.UI.WebControls.TListControl');
class TDropDownList extends TListControl implements IPostBackDataHandler, IValidatable
{
private $_dataChanged=false;
+ private $_isValid=true;
/**
* Adds attributes to renderer.
@@ -127,5 +128,22 @@ class TDropDownList extends TListControl implements IPostBackDataHandler, IValid
{
return $this->getSelectedValue();
}
+
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
}
?>
diff --git a/framework/Web/UI/WebControls/TFileUpload.php b/framework/Web/UI/WebControls/TFileUpload.php
index 47d49c0c..3f078f4e 100644
--- a/framework/Web/UI/WebControls/TFileUpload.php
+++ b/framework/Web/UI/WebControls/TFileUpload.php
@@ -59,6 +59,7 @@ class TFileUpload extends TWebControl implements IPostBackDataHandler, IValidata
*/
private $_errorCode=UPLOAD_ERR_NO_FILE;
private $_dataChanged=false;
+ private $_isValid=true;
/**
* @return string tag name of the file upload control
@@ -255,6 +256,24 @@ class TFileUpload extends TWebControl implements IPostBackDataHandler, IValidata
{
return $this->getFileName();
}
+
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
}
?>
diff --git a/framework/Web/UI/WebControls/THiddenField.php b/framework/Web/UI/WebControls/THiddenField.php
index 2fbbcf99..c0aa9c4e 100644
--- a/framework/Web/UI/WebControls/THiddenField.php
+++ b/framework/Web/UI/WebControls/THiddenField.php
@@ -26,6 +26,7 @@
class THiddenField extends TControl implements IPostBackDataHandler, IValidatable, IDataRenderer
{
private $_dataChanged=false;
+ private $_isValid=true;
/**
* @return string tag name of the hidden field.
@@ -111,6 +112,23 @@ class THiddenField extends TControl implements IPostBackDataHandler, IValidatabl
return $this->getValue();
}
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
/**
* Raises postdata changed event.
* This method calls {@link onValueChanged} method.
diff --git a/framework/Web/UI/WebControls/TListBox.php b/framework/Web/UI/WebControls/TListBox.php
index 903dbed8..a723020d 100644
--- a/framework/Web/UI/WebControls/TListBox.php
+++ b/framework/Web/UI/WebControls/TListBox.php
@@ -39,6 +39,7 @@ Prado::using('System.Web.UI.WebControls.TListControl');
class TListBox extends TListControl implements IPostBackDataHandler, IValidatable
{
private $_dataChanged=false;
+ private $_isValid=true;
/**
* Adds attribute name-value pairs to renderer.
@@ -220,6 +221,23 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl
{
return $this->getSelectedValue();
}
+
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
}
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index 3c3e6d0e..7a420e15 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -67,6 +67,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
*/
private $_safeText;
private $_dataChanged=false;
+ private $_isValid=true;
/**
* @return string tag name of the textbox
@@ -243,6 +244,23 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
return $this->getText();
}
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
/**
* Raises <b>OnTextChanged</b> event.
* This method is invoked when the value of the {@link getText Text}