diff options
author | wei <> | 2006-02-02 05:04:50 +0000 |
---|---|---|
committer | wei <> | 2006-02-02 05:04:50 +0000 |
commit | a2a030c3cfbb0249762fffa4159107bc13f8952d (patch) | |
tree | e8b2f97068cf92a314df360ccf8dfb1d37b92bd6 /framework/Web/Javascripts/prado | |
parent | 93f6933c39b2e1896ff781a8f839a3c73a7e56b1 (diff) |
Fixed #19
Diffstat (limited to 'framework/Web/Javascripts/prado')
-rw-r--r-- | framework/Web/Javascripts/prado/controls.js | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/framework/Web/Javascripts/prado/controls.js b/framework/Web/Javascripts/prado/controls.js index 370741d4..c472c1be 100644 --- a/framework/Web/Javascripts/prado/controls.js +++ b/framework/Web/Javascripts/prado/controls.js @@ -32,9 +32,33 @@ Prado.WebUI.TButton = Prado.WebUI.createPostBackComponent(); Prado.WebUI.ClickableComponent = Prado.WebUI.createPostBackComponent(
{
+ _elementOnClick : null, //capture the element's onclick function
+
onInit : function(options)
{
- Event.observe(this.element, "click", Prado.PostBack.bindEvent(this,options));
+ if(isFunction(this.element.onclick))
+ {
+ this._elementOnClick = this.element.onclick;
+ this.element.onclick = null;
+ }
+ Event.observe(this.element, "click", this.onClick.bindEvent(this,options));
+ },
+
+ onClick : function(event, options)
+ {
+ var src = Event.element(event);
+ var doPostBack = true;
+ var onclicked = null;
+ if(this._elementOnClick)
+ {
+ var onclicked = this._elementOnClick(event);
+ if(isBoolean(onclicked))
+ doPostBack = onclicked;
+ }
+ if(doPostBack)
+ Prado.PostBack(event,options);
+ if(isBoolean(onclicked) && !onclicked)
+ Event.stop(event);
}
});
@@ -49,7 +73,7 @@ Prado.WebUI.TTextBox = Prado.WebUI.createPostBackComponent( onInit : function(options)
{
if(options['TextMode'] != 'MultiLine')
- Event.observe(this.element, "down", this.handleReturnKey.bind(this));
+ Event.observe(this.element, "keydown", this.handleReturnKey.bind(this));
Event.observe(this.element, "change", Prado.PostBack.bindEvent(this,options));
},
|