diff options
18 files changed, 279 insertions, 56 deletions
| diff --git a/.gitattributes b/.gitattributes index 632c072d..6e799161 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2186,6 +2186,8 @@ tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonTest.page  tests/FunctionalTests/active-controls/protected/pages/ActiveRadioButtonTest.php -text  tests/FunctionalTests/active-controls/protected/pages/ActiveRedirectionTest.page -text  tests/FunctionalTests/active-controls/protected/pages/ActiveRedirectionTest.php -text +tests/FunctionalTests/active-controls/protected/pages/Callback.page -text +tests/FunctionalTests/active-controls/protected/pages/Callback.php -text  tests/FunctionalTests/active-controls/protected/pages/CallbackCustomValidatorTest.page -text  tests/FunctionalTests/active-controls/protected/pages/CallbackCustomValidatorTest.php -text  tests/FunctionalTests/active-controls/protected/pages/ClientSideDispatch.page -text @@ -2428,6 +2430,10 @@ tests/FunctionalTests/tickets/protected/pages/Ticket573.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket578.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket578.php -text  tests/FunctionalTests/tickets/protected/pages/Ticket583/Home.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket585.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket585.php -text +tests/FunctionalTests/tickets/protected/pages/Ticket586.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket586.php -text  tests/FunctionalTests/tickets/protected/pages/Ticket68.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket72.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket72.php -text @@ -2463,6 +2469,8 @@ tests/FunctionalTests/tickets/tests/Ticket538TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket54TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket573TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket578TestCase.php -text +tests/FunctionalTests/tickets/tests/Ticket585TestCase.php -text +tests/FunctionalTests/tickets/tests/Ticket586TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket72TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket93TestCase.php -text  tests/FunctionalTests/validators.php -text diff --git a/framework/Web/Javascripts/js/compressed/validator.js b/framework/Web/Javascripts/js/compressed/validator.js index 49316113..0571b27b 100644 --- a/framework/Web/Javascripts/js/compressed/validator.js +++ b/framework/Web/Javascripts/js/compressed/validator.js @@ -76,7 +76,7 @@ this.messages.show();this.visible=true;},formats:function(type)  {switch(this.options.DisplayMode)  {case"List":output+=messages[i]+"\n";break;case"BulletList":default:output+="  - "+messages[i]+"\n";break;case"SingleParagraph":output+=messages[i]+" ";break;}}  return output;}};Prado.WebUI.TBaseValidator=Class.create();Prado.WebUI.TBaseValidator.prototype={initialize:function(options) -{this.enabled=true;this.visible=false;this.isValid=true;this._isObserving={};this.group=null;this.requestDispatched=false;this.options=options;this.control=$(options.ControlToValidate);this.message=$(options.ID);if(this.control&&this.message) +{this.enabled=true;this.visible=false;this.isValid=true;this._isObserving={};this.group=null;this.options=options;this.control=$(options.ControlToValidate);this.message=$(options.ID);if(this.control&&this.message)  {this.group=options.ValidationGroup;this.manager=Prado.Validation.addValidator(options.FormID,this);}},getErrorMessage:function()  {return this.options.ErrorMessage;},updateControl:function(focus)  {this.refreshControlAndMessage();if(this.options.FocusOnError&&!this.isValid) @@ -96,23 +96,20 @@ control.addClassName(CssClass);}},hide:function()  this.control=$(this.options.ControlToValidate);if(!this.control)  {this.isValid=true;return this.isValid;}  if(typeof(this.options.OnValidate)=="function") -{if(this.requestDispatched==false) -this.options.OnValidate(this,invoker);} +{this.options.OnValidate(this,invoker);}  if(this.enabled)  this.isValid=this.evaluateIsValid();else -this.isValid=true;if(this.isValid) +this.isValid=true;this.updateValidationDisplay(invoker);this.observeChanges(this.control);return this.isValid;},updateValidationDisplay:function(invoker) +{if(this.isValid)  {if(typeof(this.options.OnValidationSuccess)=="function") -{if(this.requestDispatched==false) -{this.refreshControlAndMessage();this.options.OnValidationSuccess(this,invoker);}} +{this.refreshControlAndMessage();this.options.OnValidationSuccess(this,invoker);}  else  this.updateControl();}  else  {if(typeof(this.options.OnValidationError)=="function") -{if(this.requestDispatched==false) -{this.refreshControlAndMessage();this.options.OnValidationError(this,invoker)}} +{this.refreshControlAndMessage();this.options.OnValidationError(this,invoker)}  else -this.updateControl();} -this.observeChanges(this.control);return this.isValid;},observeChanges:function(control) +this.updateControl();}},observeChanges:function(control)  {if(!control)return;var canObserveChanges=this.options.ObserveChanges!=false;var currentlyObserving=this._isObserving[control.id+this.options.ID];if(canObserveChanges&&!currentlyObserving)  {var validator=this;Event.observe(control,'change',function()  {if(validator.visible) @@ -136,7 +133,7 @@ switch(this.options.ControlType)  else  return value;}  else -{this.observeDatePickerChanges();return Prado.WebUI.TDatePicker.getDropDownDate(control).getTime();} +{this.observeDatePickerChanges();return Prado.WebUI.TDatePicker.getDropDownDate(control);}  case'THtmlArea':if(typeof tinyMCE!="undefined")  tinyMCE.triggerSave();return this.trim($F(control));case'TRadioButton':if(this.options.GroupName)  return this.getRadioButtonGroupValue();default:if(this.isListControlType()) @@ -182,12 +179,13 @@ return true;switch(this.options.Operator)  {var value=this.getValidationValue();var clientFunction=this.options.ClientValidationFunction;if(typeof(clientFunction)=="string"&&clientFunction.length>0)  {validate=clientFunction.toFunction();return validate(this,value);}  return true;}});Prado.WebUI.TActiveCustomValidator=Class.extend(Prado.WebUI.TBaseValidator,{validatingValue:null,evaluateIsValid:function() -{value=this.getValidationValue();if(!this.requestDispatched&&value!=this.validatingValue) -{this.validatingValue=value;request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.setCallbackParameter(value);request.setCausesValidation(false);request.options.onSuccess=this.callbackOnSuccess.bind(this);request.options.onFailure=this.callbackOnFailure.bind(this);request.dispatch();this.requestDispatched=true;return false;} +{value=this.getValidationValue();if((""+value)!=(""+this.validatingValue)) +{this.validatingValue=value;request=new Prado.CallbackRequest(this.options.EventTarget,this.options);if(this.options.DateFormat&&value instanceof Date) +value=value.SimpleFormat(this.options.DateFormat);request.setCallbackParameter(value);request.setCausesValidation(false);request.options.onSuccess=this.callbackOnSuccess.bind(this);request.options.onFailure=this.callbackOnFailure.bind(this);request.dispatch();return false;}  return this.isValid;},callbackOnSuccess:function(request,data) -{this.isValid=data;this.requestDispatched=false;if(typeof(this.options.onSuccess)=="function") -this.options.onSuccess(request,data);Prado.Validation.validate(this.options.FormID,this.group,null);},callbackOnFailure:function(request,data) -{this.requestDispatched=false;if(typeof(this.options.onFailure)=="function") +{this.isValid=data;if(typeof(this.options.onSuccess)=="function") +this.options.onSuccess(request,data);this.updateValidationDisplay();},callbackOnFailure:function(request,data) +{if(typeof(this.options.onFailure)=="function")  this.options.onFailure(request,data);}});Prado.WebUI.TRangeValidator=Class.extend(Prado.WebUI.TBaseValidator,{evaluateIsValid:function()  {var value=this.getValidationValue();if(value.length<=0)  return true;if(typeof(this.options.DataType)=="undefined") diff --git a/framework/Web/Javascripts/js/debug/validator.js b/framework/Web/Javascripts/js/debug/validator.js index 179963f4..7d17eeda 100644 --- a/framework/Web/Javascripts/js/debug/validator.js +++ b/framework/Web/Javascripts/js/debug/validator.js @@ -571,7 +571,7 @@ Prado.WebUI.TBaseValidator.prototype =  		this.isValid = true;
  		this._isObserving = {};
  		this.group = null;
 -		this.requestDispatched = false;
 +		//this.requestDispatched = false;
  		this.options = options;
  		this.control = $(options.ControlToValidate);
 @@ -676,7 +676,7 @@ Prado.WebUI.TBaseValidator.prototype =  		if(typeof(this.options.OnValidate) == "function")
  		{
 -			if(this.requestDispatched == false)
 +			//if(this.requestDispatched == false)
  				this.options.OnValidate(this, invoker);
  		}
 @@ -685,15 +685,26 @@ Prado.WebUI.TBaseValidator.prototype =  		else
  			this.isValid = true;
 +		this.updateValidationDisplay(invoker);
 +		this.observeChanges(this.control);
 +
 +		return this.isValid;
 +	},
 +
 +	/**
 +	 * Updates the validation messages, update the control to be validated.
 +	 */
 +	updateValidationDisplay : function(invoker)
 +	{
  		if(this.isValid)
  		{
  			if(typeof(this.options.OnValidationSuccess) == "function")
  			{
 -				if(this.requestDispatched == false)
 -				{
 +				//if(this.requestDispatched == false)
 +				//{
  					this.refreshControlAndMessage();
  					this.options.OnValidationSuccess(this, invoker);
 -				}
 +				//}
  			}
  			else
  				this.updateControl();
 @@ -702,19 +713,15 @@ Prado.WebUI.TBaseValidator.prototype =  		{
  			if(typeof(this.options.OnValidationError) == "function")
  			{
 -				if(this.requestDispatched == false)
 -				{
 +				//if(this.requestDispatched == false)
 +				//{
  					this.refreshControlAndMessage();
  					this.options.OnValidationError(this, invoker)
 -				}
 +				//}
  			}
  			else
  				this.updateControl();
  		}
 -
 -		this.observeChanges(this.control);
 -
 -		return this.isValid;
  	},
  	/**
 @@ -816,7 +823,7 @@ Prado.WebUI.TBaseValidator.prototype =  	 			{
  	 				this.observeDatePickerChanges();
 -	 				return Prado.WebUI.TDatePicker.getDropDownDate(control).getTime();
 +	 				return Prado.WebUI.TDatePicker.getDropDownDate(control);//.getTime();
  	 			}
  	 		case 'THtmlArea':
  	 			if(typeof tinyMCE != "undefined")
 @@ -1126,16 +1133,19 @@ Prado.WebUI.TActiveCustomValidator = Class.extend(Prado.WebUI.TBaseValidator,  	evaluateIsValid : function()
  	{
  		value = this.getValidationValue();
 -		if(!this.requestDispatched && value != this.validatingValue)
 +		//if(!this.requestDispatched && (""+value) != (""+this.validatingValue))
 +		if((""+value) != (""+this.validatingValue))
  		{
  			this.validatingValue = value;
  			request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
 +			if(this.options.DateFormat && value instanceof Date) //change date to string with formatting.
 +				value = value.SimpleFormat(this.options.DateFormat);
  			request.setCallbackParameter(value);
  			request.setCausesValidation(false);
  			request.options.onSuccess = this.callbackOnSuccess.bind(this);
  			request.options.onFailure = this.callbackOnFailure.bind(this);
  			request.dispatch();
 -			this.requestDispatched = true;
 +//			this.requestDispatched = true;
  			return false;
  		}
  		return this.isValid;
 @@ -1144,15 +1154,15 @@ Prado.WebUI.TActiveCustomValidator = Class.extend(Prado.WebUI.TBaseValidator,  	callbackOnSuccess : function(request, data)
  	{
  		this.isValid = data;
 -		this.requestDispatched = false;
 +//		this.requestDispatched = false;
  		if(typeof(this.options.onSuccess) == "function")
  			this.options.onSuccess(request,data);
 -		Prado.Validation.validate(this.options.FormID, this.group,null);
 +		this.updateValidationDisplay();
  	},
  	callbackOnFailure : function(request, data)
  	{
 -		this.requestDispatched = false;
 +//		this.requestDispatched = false;
  		if(typeof(this.options.onFailure) == "function")
  			this.options.onFailure(request,data);
  	}
 diff --git a/framework/Web/Javascripts/prado/validator/validation3.js b/framework/Web/Javascripts/prado/validator/validation3.js index 9b5b4046..5fa879a5 100644 --- a/framework/Web/Javascripts/prado/validator/validation3.js +++ b/framework/Web/Javascripts/prado/validator/validation3.js @@ -571,7 +571,7 @@ Prado.WebUI.TBaseValidator.prototype =  		this.isValid = true;
  		this._isObserving = {};
  		this.group = null;
 -		this.requestDispatched = false;
 +		//this.requestDispatched = false;
  		this.options = options;
  		this.control = $(options.ControlToValidate);
 @@ -676,7 +676,7 @@ Prado.WebUI.TBaseValidator.prototype =  		if(typeof(this.options.OnValidate) == "function")
  		{
 -			if(this.requestDispatched == false)
 +			//if(this.requestDispatched == false)
  				this.options.OnValidate(this, invoker);
  		}
 @@ -685,15 +685,26 @@ Prado.WebUI.TBaseValidator.prototype =  		else
  			this.isValid = true;
 +		this.updateValidationDisplay(invoker);
 +		this.observeChanges(this.control);
 +
 +		return this.isValid;
 +	},
 +
 +	/**
 +	 * Updates the validation messages, update the control to be validated.
 +	 */
 +	updateValidationDisplay : function(invoker)
 +	{
  		if(this.isValid)
  		{
  			if(typeof(this.options.OnValidationSuccess) == "function")
  			{
 -				if(this.requestDispatched == false)
 -				{
 +				//if(this.requestDispatched == false)
 +				//{
  					this.refreshControlAndMessage();
  					this.options.OnValidationSuccess(this, invoker);
 -				}
 +				//}
  			}
  			else
  				this.updateControl();
 @@ -702,19 +713,15 @@ Prado.WebUI.TBaseValidator.prototype =  		{
  			if(typeof(this.options.OnValidationError) == "function")
  			{
 -				if(this.requestDispatched == false)
 -				{
 +				//if(this.requestDispatched == false)
 +				//{
  					this.refreshControlAndMessage();
  					this.options.OnValidationError(this, invoker)
 -				}
 +				//}
  			}
  			else
  				this.updateControl();
  		}
 -
 -		this.observeChanges(this.control);
 -
 -		return this.isValid;
  	},
  	/**
 @@ -816,7 +823,7 @@ Prado.WebUI.TBaseValidator.prototype =  	 			{
  	 				this.observeDatePickerChanges();
 -	 				return Prado.WebUI.TDatePicker.getDropDownDate(control).getTime();
 +	 				return Prado.WebUI.TDatePicker.getDropDownDate(control);//.getTime();
  	 			}
  	 		case 'THtmlArea':
  	 			if(typeof tinyMCE != "undefined")
 @@ -1126,16 +1133,19 @@ Prado.WebUI.TActiveCustomValidator = Class.extend(Prado.WebUI.TBaseValidator,  	evaluateIsValid : function()
  	{
  		value = this.getValidationValue();
 -		if(!this.requestDispatched && value != this.validatingValue)
 +		//if(!this.requestDispatched && (""+value) != (""+this.validatingValue))
 +		if((""+value) != (""+this.validatingValue))
  		{
  			this.validatingValue = value;
  			request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
 +			if(this.options.DateFormat && value instanceof Date) //change date to string with formatting.
 +				value = value.SimpleFormat(this.options.DateFormat);
  			request.setCallbackParameter(value);
  			request.setCausesValidation(false);
  			request.options.onSuccess = this.callbackOnSuccess.bind(this);
  			request.options.onFailure = this.callbackOnFailure.bind(this);
  			request.dispatch();
 -			this.requestDispatched = true;
 +//			this.requestDispatched = true;
  			return false;
  		}
  		return this.isValid;
 @@ -1144,15 +1154,15 @@ Prado.WebUI.TActiveCustomValidator = Class.extend(Prado.WebUI.TBaseValidator,  	callbackOnSuccess : function(request, data)
  	{
  		this.isValid = data;
 -		this.requestDispatched = false;
 +//		this.requestDispatched = false;
  		if(typeof(this.options.onSuccess) == "function")
  			this.options.onSuccess(request,data);
 -		Prado.Validation.validate(this.options.FormID, this.group,null);
 +		this.updateValidationDisplay();
  	},
  	callbackOnFailure : function(request, data)
  	{
 -		this.requestDispatched = false;
 +//		this.requestDispatched = false;
  		if(typeof(this.options.onFailure) == "function")
  			this.options.onFailure(request,data);
  	}
 diff --git a/framework/Web/UI/ActiveControls/TActivePageAdapter.php b/framework/Web/UI/ActiveControls/TActivePageAdapter.php index da53856a..ea5d673b 100644 --- a/framework/Web/UI/ActiveControls/TActivePageAdapter.php +++ b/framework/Web/UI/ActiveControls/TActivePageAdapter.php @@ -15,6 +15,7 @@   */
  Prado::using('System.Web.UI.ActiveControls.TCallbackResponseAdapter');
  Prado::using('System.Web.UI.ActiveControls.TCallbackClientScript');
 +Prado::using('System.Web.UI.ActiveControls.TCallbackEventParameter');
  /**
   * TActivePageAdapter class.
 diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index 8870666e..a319595d 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -238,6 +238,7 @@ class TClientScriptManager extends TApplicationComponent  	 */  	public function registerDefaultButton($panel, $button)  	{ +		$button->setIsDefaultButton(true);  		$options = TJavaScript::encode($this->getDefaultButtonOptions($panel, $button));  		$code = "new Prado.WebUI.DefaultButton($options);"; diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index 85770cb4..68e10c6e 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -2089,6 +2089,16 @@ interface IButtonControl  	 * @param TCommandEventParameter event parameter to be passed to the event handlers
  	 */
  	public function onCommand($param);
 +
 +	/**
 +	 * @param boolean set by a panel to register this button as the default button for the panel.
 +	 */
 +	public function setIsDefaultButton($value);
 +
 +	/**
 +	 * @return boolean true if this button is registered as a default button for a panel.
 +	 */
 +	public function getIsDefaultButton();
  }
  /**
 diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index aa4e21a7..9f2b2825 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -131,12 +131,29 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr  	}
  	/**
 +	 * @param boolean set by a panel to register this button as the default button for the panel.
 +	 */
 +	public function setIsDefaultButton($value)
 +	{
 +		$this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false);
 +	}
 +
 +	/**
 +	 * @return boolean true if this button is registered as a default button for a panel.
 +	 */
 +	public function getIsDefaultButton()
 +	{
 +		return $this->getViewState('IsDefaultButton', false);
 +	}
 +
 +	/**
  	 * @return boolean whether the button needs javascript to do postback
  	 */
  	protected function needPostBackScript()
  	{
 -		//IE needs JS to be rendered for default button to work if no validators are assigned to this button
 -		return $this->canCauseValidation() || $this->hasEventHandler('OnClick') || $this->hasEventHandler('OnCommand');
 +		return $this->canCauseValidation() || ($this->getButtonType()!==TButtonType::Submit &&
 +			($this->hasEventHandler('OnClick') || $this->hasEventHandler('OnCommand')))
 +			|| $this->getIsDefaultButton();
  	}
  	/**
 diff --git a/framework/Web/UI/WebControls/TImageButton.php b/framework/Web/UI/WebControls/TImageButton.php index 41de5087..44d4c14b 100644 --- a/framework/Web/UI/WebControls/TImageButton.php +++ b/framework/Web/UI/WebControls/TImageButton.php @@ -148,12 +148,27 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven  	}
  	/**
 +	 * @param boolean set by a panel to register this button as the default button for the panel.
 +	 */
 +	public function setIsDefaultButton($value)
 +	{
 +		$this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false);
 +	}
 +
 +	/**
 +	 * @return boolean true if this button is registered as a default button for a panel.
 +	 */
 +	public function getIsDefaultButton()
 +	{
 +		return $this->getViewState('IsDefaultButton', false);
 +	}
 +
 +	/**
  	 * @return boolean whether the button needs javascript to do postback
  	 */
  	protected function needPostBackScript()
  	{
 -		//IE needs JS to be rendered for default button to work if no validators are assigned to this button
 -		return $this->canCauseValidation() || $this->hasEventHandler('OnClick') || $this->hasEventHandler('OnCommand');
 +		return $this->canCauseValidation() || $this->getIsDefaultButton();
  	}
  	/**
 diff --git a/framework/Web/UI/WebControls/TLinkButton.php b/framework/Web/UI/WebControls/TLinkButton.php index d993b9f5..f92dded3 100644 --- a/framework/Web/UI/WebControls/TLinkButton.php +++ b/framework/Web/UI/WebControls/TLinkButton.php @@ -116,6 +116,22 @@ class TLinkButton extends TWebControl implements IPostBackEventHandler, IButtonC  	}
  	/**
 +	 * @param boolean set by a panel to register this button as the default button for the panel.
 +	 */
 +	public function setIsDefaultButton($value)
 +	{
 +		$this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false);
 +	}
 +
 +	/**
 +	 * @return boolean true if this button is registered as a default button for a panel.
 +	 */
 +	public function getIsDefaultButton()
 +	{
 +		return $this->getViewState('IsDefaultButton', false);
 +	}
 +
 +	/**
  	 * Renders the Href for link button.
  	 * @param THtmlWriter renderer
  	 */
 diff --git a/tests/FunctionalTests/active-controls/protected/pages/Callback.page b/tests/FunctionalTests/active-controls/protected/pages/Callback.page new file mode 100644 index 00000000..d8744760 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/Callback.page @@ -0,0 +1,15 @@ +<com:TForm>
 +
 +	<com:TCallback ID="callback1" OnCallback="callback1_Requested" />
 +	 <script type="text/javascript">              
 +	function do_callback1()
 +	{               
 +		 var callback =  <%= $this->callback1->ActiveControl->Javascript %>;
 +		 callback.dispatch();
 +	}       
 +	</script>       
 +	<div onclick="do_callback1()">Click Me!</div>
 +
 +	<com:TJavascriptLogger />
 +
 +</com:TForm>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/Callback.php b/tests/FunctionalTests/active-controls/protected/pages/Callback.php new file mode 100644 index 00000000..d19d92aa --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/Callback.php @@ -0,0 +1,13 @@ +<?php
 +
 +Prado::using('System.Web.UI.ActiveControls.*');
 +
 +class Callback extends TPage
 +{
 +	function callback1_Requested()
 +	{
 +		var_dump("ok!");
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket585.page b/tests/FunctionalTests/tickets/protected/pages/Ticket585.page new file mode 100644 index 00000000..f5e26f24 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket585.page @@ -0,0 +1,19 @@ +<com:TContent ID="Content">
 +
 +<com:TDatePicker id="test" />
 +<com:TActiveCustomValidator
 +	ID="validator1"
 +	ControlToValidate="test"
 +	OnServerValidate="ChkDate"
 +	ErrorMessage="*">		
 +	<prop:ClientSide
 +		OnValidationError="$('error').innerHTML='Error'"
 +		OnValidationSuccess="$('error').innerHTML='Success'"
 +		ObserveChanges="false"
 +		
 +	 />
 +</com:TActiveCustomValidator>
 +<span id="error"></span>
 +<com:TButton ID="button1" Text="ok"/>
 +
 +</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket585.php b/tests/FunctionalTests/tickets/protected/pages/Ticket585.php new file mode 100644 index 00000000..5932146d --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket585.php @@ -0,0 +1,18 @@ +<?php
 +Prado::using('System.Web.UI.ActiveControls.*');
 +class Ticket585 extends TPage
 +{
 +
 +	public function ChkDate ($sender, $param)
 +	{
 +		if ($param->Value == "15-03-2007")
 +		{
 +			$param->IsValid=false;
 +		}
 +		else
 +			$param->IsValid=true;
 +	}
 +
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket586.page b/tests/FunctionalTests/tickets/protected/pages/Ticket586.page new file mode 100644 index 00000000..93c27385 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket586.page @@ -0,0 +1,13 @@ +<com:TContent ID="Content">
 +
 +<com:TPanel DefaultButton="button2" Style="border:1px solid #ccc; padding:2em;">
 +
 +<com:TTextBox ID="text1" />
 +<com:TButton ID="button1" Text="Button 1" OnClick="button_clicked"/>
 +<com:TButton ID="button2" Text="Button 2 (default)" OnClick="button_clicked"/>
 +<com:TButton ID="button3" Text="Button 3" OnClick="button_clicked" />
 +
 +<com:TLabel ID="label1" Text="Status" />
 +</com:TPanel>
 +
 +</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket586.php b/tests/FunctionalTests/tickets/protected/pages/Ticket586.php new file mode 100644 index 00000000..d6fafd0d --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket586.php @@ -0,0 +1,11 @@ +<?php
 +
 +class Ticket586 extends TPage
 +{
 +	function button_clicked($sender, $param)
 +	{
 +		$this->label1->Text = $sender->Text . ' Clicked!';
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket585TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket585TestCase.php new file mode 100644 index 00000000..cbcb7bb2 --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket585TestCase.php @@ -0,0 +1,27 @@ +<?php
 +
 +class Ticket585TestCase extends SeleniumTestCase
 +{
 +	function test()
 +	{
 +		$base = 'ctl0_Content_';
 +		$this->open('tickets/index.php?page=Ticket585');
 +		$this->verifyTitle("Verifying Ticket 585", "");
 +
 +		$this->assertText("error", "");
 +		$this->assertNotVisible("{$base}validator1");
 +
 +		$this->click("{$base}button1");
 +		$this->pause(800);
 +		$this->assertText("error", "Success");
 +		$this->assertNotVisible("{$base}validator1");
 +
 +		$this->type("{$base}test", "15-03-2007");
 +		$this->click("{$base}button1");
 +		$this->pause(800);
 +		$this->assertText("error", "Error");
 +		$this->assertVisible("{$base}validator1");
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket586TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket586TestCase.php new file mode 100644 index 00000000..4b5619cd --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket586TestCase.php @@ -0,0 +1,21 @@ +<?php
 +
 +class Ticket586TestCase extends SeleniumTestCase
 +{
 +	function test()
 +	{
 +		$base = 'ctl0_Content_';
 +		$this->open('tickets/index.php?page=Ticket586');
 +		$this->verifyTitle("Verifying Ticket 586", "");
 +
 +		$this->assertText("{$base}label1", "Status");
 +		$this->clickAndWait("{$base}button1");
 +		$this->assertText("{$base}label1", "Button 1 Clicked!");
 +
 +		$this->type("{$base}text1", "testing");
 +		$this->keyDownAndWait("{$base}text1", '\13');
 +		$this->assertText("{$base}label1", "Button 2 (default) Clicked!");
 +	}
 +}
 +
 +?>
\ No newline at end of file | 
