Roo/bootstrap/Form.js
authorEdward <edward@roojs.com>
Mon, 12 May 2014 05:18:22 +0000 (13:18 +0800)
committerEdward <edward@roojs.com>
Mon, 12 May 2014 05:18:22 +0000 (13:18 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/bootstrap/Form.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index db3ece9..fe290ed 100644 (file)
@@ -234,7 +234,7 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
             this.fireEvent('actioncomplete', this, action);
             
         }else{
-            
+            Roo.log('go into the fail??');
             // failure condition..
             // we have a scenario where updates need confirming.
             // eg. if a locking scenario exists..
index 265d3f3..bb61d36 100644 (file)
@@ -3283,7 +3283,7 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
             this.fireEvent('actioncomplete', this, action);
             
         }else{
-            
+            Roo.log('go into the fail??');
             // failure condition..
             // we have a scenario where updates need confirming.
             // eg. if a locking scenario exists..
index a8ea1c3..7db6a6a 100644 (file)
@@ -86,7 +86,7 @@ this.form.clearInvalid();this.form.setValues(B.data);this.form.afterAction(this,
 //Roo/bootstrap/Form.js
 Roo.bootstrap.Form=function(A){Roo.bootstrap.Form.superclass.constructor.call(this,A);this.addEvents({clientvalidation:true,beforeaction:true,actionfailed:true,actioncomplete:true});};Roo.extend(Roo.bootstrap.Form,Roo.bootstrap.Component,{method:'POST',timeout:30,align:'left',activeAction:null,waitMsgTarget:false,getAutoCreate:function(){var A={tag:'form',method:this.method||'POST',id:this.id||Roo.id(),cls:''};if(this.parent().xtype.match(/^Nav/)){A.cls='navbar-form navbar-'+this.align;}if(this.labelAlign=='left'){A.cls+=' form-horizontal';}return A;},initEvents:function(){this.el.on('submit',this.onSubmit,this);},onSubmit:function(e){e.stopEvent();},isValid:function(){var A=this.getItems();var B=true;A.each(function(f){if(!f.validate()){B=false;}});return B;},isDirty:function(){var A=false;var B=this.getItems();B.each(function(f){if(f.isDirty()){A=true;return false;}return true;});return A;},doAction:function(A,B){if(typeof A=='string'){A=new Roo.form.Action.ACTION_TYPES[A](this,B);}
 Roo.log(A);if(this.fireEvent('beforeaction',this,A)!==false){Roo.log('in!!!');this.beforeAction(A);A.run.defer(100,A);}return this;},beforeAction:function(A){var o=A.options;this.el.mask(o.waitMsg||"Sending",'x-mask-loading');},afterAction:function(A,B){this.activeAction=null;var o=A.options;this.el.unmask();if(B){if(o.reset){this.reset();}
-Roo.callback(o.success,o.scope,[this,A]);this.fireEvent('actioncomplete',this,A);}else {if((typeof(A.result)!='undefined')&&(typeof(A.result.errors)!='undefined')&&(typeof(A.result.errors.needs_confirm)!='undefined')){var _t=this;Roo.log("not supported yet");return;}
+Roo.callback(o.success,o.scope,[this,A]);this.fireEvent('actioncomplete',this,A);}else {Roo.log('go into the fail??');if((typeof(A.result)!='undefined')&&(typeof(A.result.errors)!='undefined')&&(typeof(A.result.errors.needs_confirm)!='undefined')){var _t=this;Roo.log("not supported yet");return;}
 Roo.callback(o.failure,o.scope,[this,A]);if(!this.hasListener('actionfailed')){Roo.log("need to add dialog support");}
 this.fireEvent('actionfailed',this,A);}},findField:function(id){var A=this.getItems();var B=A.get(id);if(!B){A.each(function(f){if(f.isFormField&&(f.dataIndex==id||f.id==id||f.getName()==id)){B=f;return false;}return true;});}return B||null;},markInvalid:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var C=A[i];var f=this.findField(C.id);if(f){f.markInvalid(C.msg);}}}else {var D,id;for(id in A){if(typeof A[id]!='function'&&(D=this.findField(id))){D.markInvalid(A[id]);}}}return this;},setValues:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var v=A[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else {var C,id;for(id in A){if(typeof A[id]!='function'&&(C=this.findField(id))){if(C.setFromData&&C.valueField&&C.displayField&&(C.store&&!C.store.isLocal)){var sd={};sd[C.valueField]=typeof(A[C.hiddenName])=='undefined'?'':A[C.hiddenName];sd[C.displayField]=typeof(A[C.name])=='undefined'?'':A[C.name];C.setFromData(sd);}else {C.setValue(A[id]);}if(this.trackResetOnLoad){C.originalValue=C.getValue();}}}}return this;},getValues:function(A){var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){var B=this.getItems();var C={};B.each(function(f){if(!f.getName()){return;}var v=f.getValue();if(f.inputType=='radio'){if(typeof(C[f.getName()])=='undefined'){C[f.getName()]='';}if(!f.el.dom.checked){return;}
 v=f.el.dom.value;}if((typeof(v)=='object')&&f.getRawValue){v=f.getRawValue();}if(f.name!=f.getName()){C[f.name]=f.getRawValue();}