diff options
Diffstat (limited to 'framework/Web')
-rw-r--r-- | framework/Web/Javascripts/base/postback.js | 3 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/base.js | 9 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TBaseValidator.php | 19 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TButton.php | 2 |
4 files changed, 19 insertions, 14 deletions
diff --git a/framework/Web/Javascripts/base/postback.js b/framework/Web/Javascripts/base/postback.js index 7acb945e..2889c4ff 100644 --- a/framework/Web/Javascripts/base/postback.js +++ b/framework/Web/Javascripts/base/postback.js @@ -12,7 +12,8 @@ Prado.doPostBack = function(formID, eventTarget, eventParameter, performValidati var canSubmit = true;
if (performValidation)
{
- canSubmit = Prado.Validation.validate(validationGroup);
+ //canSubmit = Prado.Validation.validate(validationGroup);
+ canSubmit = Prado.Validation.OnSubmit();
}
if (canSubmit)
{
diff --git a/framework/Web/Javascripts/js/base.js b/framework/Web/Javascripts/js/base.js index b999f722..86c7ef83 100644 --- a/framework/Web/Javascripts/js/base.js +++ b/framework/Web/Javascripts/js/base.js @@ -871,13 +871,6 @@ return false; } return true; }; -Prado.LinkButton=Class.create(); -Prado.LinkButton.prototype={initialize:function(_7,_8){ -Event.observe(_7,"click",function(e){ -Prado.doPostback(_7,_8,""); -Event.stop(e); -}); -}}; Prado.doPostBack=function(_1,_2,_3,_4,_5,_6,_7,_8){ if(typeof (_4)=="undefined"){ @@ -890,7 +883,7 @@ var _8=true; var _9=document.getElementById?document.getElementById(_1):document.forms[_1]; var _10=true; if(_4){ -_10=Prado.Validation.validate(_5); +_10=Prado.Validation.OnSubmit(); } if(_10){ if(_6!=null&&(_6.length>0)){ diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index 6326783a..f8bfc28b 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -111,6 +111,14 @@ abstract class TBaseValidator extends TLabel implements IValidator */ protected function addAttributesToRender($writer) { + $display=$this->getDisplay(); + $visible=$this->getEnabled(true) && !$this->getIsValid(); + if($display==='None' || (!$visible && $display==='Dynamic')) + $writer->addStyleAttribute('display','none'); + else if(!$visible) + $writer->addStyleAttribute('visibility','hidden'); + $writer->addAttribute('id',$this->getClientID()); + parent::addAttributesToRender($writer); } /** @@ -125,7 +133,7 @@ abstract class TBaseValidator extends TLabel implements IValidator $options['FocusOnError'] = $this->getFocusOnError(); $options['FocusElementID'] = $this->getFocusElementID(); $options['ValidationGroup'] = $this->getValidationGroup(); - $options['ControlToValidate'] = $this->getControlToValidate(); + $options['ControlToValidate'] = $this->getValidationTarget()->getClientID(); return $options; } @@ -144,6 +152,7 @@ abstract class TBaseValidator extends TLabel implements IValidator $scripts->registerPradoScript('validator'); $js = "Prado.Validation.AddForm('{$this->Page->Form->ClientID}');"; $scripts->registerEndScript($scriptKey, $js); + $this->renderClientScriptValidator(); } parent::onPreRender($param); } @@ -335,10 +344,10 @@ abstract class TBaseValidator extends TLabel implements IValidator { if($control instanceof IValidatable) { - $value=$control->getValidationValue(); - if($value instanceof TListItem) - return $value->getValue(); - else + $value=$control->getValidationPropertyValue(); + //if($value instanceof TListItem) + // return $value->getValue(); + //else return TPropertyValue::ensureString($value); } else diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index 735c3b50..7109bca4 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -83,6 +83,8 @@ class TButton extends TWebControl implements IPostBackEventHandler }
else if($this->getEnabled()) // in this case, parent will not render 'disabled'
$writer->addAttribute('disabled','disabled');
+
+ $writer->addAttribute('id',$this->getClientID());
parent::addAttributesToRender($writer);
}
|