diff options
author | xue <> | 2005-12-06 15:20:50 +0000 |
---|---|---|
committer | xue <> | 2005-12-06 15:20:50 +0000 |
commit | 1e809a0a05e40786fafdb2002c7ceda8573b3f8e (patch) | |
tree | 8f60ada4241aeb297eb013f7be5c601dc9ec327d /framework/Web/Javascripts | |
parent | 703b3edacfbb12b57510d1ca441b6bbbb2fc16ab (diff) |
Diffstat (limited to 'framework/Web/Javascripts')
-rw-r--r-- | framework/Web/Javascripts/base/postback.js | 82 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/base.js | 72 |
2 files changed, 69 insertions, 85 deletions
diff --git a/framework/Web/Javascripts/base/postback.js b/framework/Web/Javascripts/base/postback.js index 8b2d522e..7acb945e 100644 --- a/framework/Web/Javascripts/base/postback.js +++ b/framework/Web/Javascripts/base/postback.js @@ -1,66 +1,54 @@ -
-Prado.PostBack = Class.create();
-
-Prado.PostBack.Options = Class.create();
-
-Prado.PostBack.Options.prototype =
+Prado.doPostBack = function(formID, eventTarget, eventParameter, performValidation, validationGroup, actionUrl, trackFocus, clientSubmit)
{
- initialize : function(performValidation, validationGroup, actionUrl, trackFocus, clientSubmit)
+ if (typeof(performValidation) == 'undefined')
{
- this.performValidation = performValidation;
- this.validationGroup = validationGroup;
- this.actionUrl = actionUrl;
- this.trackFocus = trackFocus;
- this.clientSubmit = clientSubmit;
- }
-}
-
-Prado.PostBack.perform = function(formID, eventTarget, eventParameter, options)
-{
+ var performValidation = false;
+ var validationGroup = '';
+ var actionUrl = null;
+ var trackFocus = false;
+ var clientSubmit = true;
+ }
var theForm = document.getElementById ? document.getElementById(formID) : document.forms[formID];
var canSubmit = true;
- if ((typeof(options) != 'undefined') || options == null)
+ if (performValidation)
+ {
+ canSubmit = Prado.Validation.validate(validationGroup);
+ }
+ if (canSubmit)
{
- if (options.performValidation)
+ if (actionUrl != null && (actionUrl.length > 0))
{
- canSubmit = Prado.Validation.validate(options.validationGroup);
+ theForm.action = actionUrl;
}
- if (canSubmit)
+ if (trackFocus)
{
- if ((typeof(options.actionUrl) != 'undefined') && (options.actionUrl != null) && (options.actionUrl.length > 0))
+ var lastFocus = theForm.elements['PRADO_LASTFOCUS'];
+ if ((typeof(lastFocus) != 'undefined') && (lastFocus != null))
{
- theForm.action = options.actionUrl;
- }
- if (options.trackFocus)
- {
- var lastFocus = theForm.elements['PRADO_LASTFOCUS'];
- if ((typeof(lastFocus) != 'undefined') && (lastFocus != null))
+ var active = document.activeElement;
+ if (typeof(active) == 'undefined')
{
- var active = document.activeElement;
- if (typeof(active) == 'undefined')
- {
- lastFocus.value = eventTarget;
- }
- else
+ lastFocus.value = eventTarget;
+ }
+ else
+ {
+ if ((active != null) && (typeof(active.id) != 'undefined'))
{
- if ((active != null) && (typeof(active.id) != 'undefined'))
+ if (active.id.length > 0)
+ {
+ lastFocus.value = active.id;
+ }
+ else if (typeof(active.name) != 'undefined')
{
- if (active.id.length > 0)
- {
- lastFocus.value = active.id;
- }
- else if (typeof(active.name) != 'undefined')
- {
- lastFocus.value = active.name;
- }
+ lastFocus.value = active.name;
}
}
}
}
- if (!options.clientSubmit)
- {
- canSubmit = false;
- }
+ }
+ if (!clientSubmit)
+ {
+ canSubmit = false;
}
}
if (canSubmit && (!theForm.onsubmit || theForm.onsubmit()))
diff --git a/framework/Web/Javascripts/js/base.js b/framework/Web/Javascripts/js/base.js index fdd4ee8f..d16db163 100644 --- a/framework/Web/Javascripts/js/base.js +++ b/framework/Web/Javascripts/js/base.js @@ -842,54 +842,50 @@ return _7; Prado=Class.create(); Prado.version="3.0a"; -Prado.PostBack=Class.create(); -Prado.PostBack.Options=Class.create(); -Prado.PostBack.Options.prototype={initialize:function(_1,_2,_3,_4,_5){ -this.performValidation=_1; -this.validationGroup=_2; -this.actionUrl=_3; -this.trackFocus=_4; -this.clientSubmit=_5; -}}; -Prado.PostBack.perform=function(_6,_7,_8,_9){ -var _10=document.getElementById?document.getElementById(_6):document.forms[_6]; -var _11=true; -if((typeof (_9)!="undefined")||_9==null){ -if(_9.performValidation){ -_11=Prado.Validation.validate(_9.validationGroup); -} -if(_11){ -if((typeof (_9.actionUrl)!="undefined")&&(_9.actionUrl!=null)&&(_9.actionUrl.length>0)){ -_10.action=_9.actionUrl; -} -if(_9.trackFocus){ -var _12=_10.elements["PRADO_LASTFOCUS"]; -if((typeof (_12)!="undefined")&&(_12!=null)){ -var _13=document.activeElement; -if(typeof (_13)=="undefined"){ -_12.value=_7; +Prado.doPostBack=function(_1,_2,_3,_4,_5,_6,_7,_8){ +if(typeof (_4)=="undefined"){ +var _4=false; +var _5=""; +var _6=null; +var _7=false; +var _8=true; +} +var _9=document.getElementById?document.getElementById(_1):document.forms[_1]; +var _10=true; +if(_4){ +_10=Prado.Validation.validate(_5); +} +if(_10){ +if(_6!=null&&(_6.length>0)){ +_9.action=_6; +} +if(_7){ +var _11=_9.elements["PRADO_LASTFOCUS"]; +if((typeof (_11)!="undefined")&&(_11!=null)){ +var _12=document.activeElement; +if(typeof (_12)=="undefined"){ +_11.value=_2; }else{ -if((_13!=null)&&(typeof (_13.id)!="undefined")){ -if(_13.id.length>0){ -_12.value=_13.id; +if((_12!=null)&&(typeof (_12.id)!="undefined")){ +if(_12.id.length>0){ +_11.value=_12.id; }else{ -if(typeof (_13.name)!="undefined"){ -_12.value=_13.name; -} +if(typeof (_12.name)!="undefined"){ +_11.value=_12.name; } } } } } -if(!_9.clientSubmit){ -_11=false; } +if(!_8){ +_10=false; } } -if(_11&&(!_10.onsubmit||_10.onsubmit())){ -_10.PRADO_POSTBACK_TARGET.value=_7; -_10.PRADO_POSTBACK_PARAMETER.value=_8; -_10.submit(); +if(_10&&(!_9.onsubmit||_9.onsubmit())){ +_9.PRADO_POSTBACK_TARGET.value=_2; +_9.PRADO_POSTBACK_PARAMETER.value=_3; +_9.submit(); } }; |