fix for old versions of chrome
authorAlan Knowles <alan@roojs.com>
Tue, 10 Mar 2020 09:52:52 +0000 (17:52 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 10 Mar 2020 09:52:52 +0000 (17:52 +0800)
docs/src/Roo_form_BasicForm.js.html
roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index fb6e443..d33d211 100644 (file)
@@ -540,14 +540,20 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
 
         </span><span class="jsdoc-comment">// use formdata
         </span><span class="jsdoc-keyword">if </span><span class="jsdoc-syntax">(</span><span class="jsdoc-keyword">typeof</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">FormData</span><span class="jsdoc-syntax">) != </span><span class="jsdoc-string">'undefined' </span><span class="jsdoc-syntax">&amp;&amp; </span><span class="jsdoc-var">asString </span><span class="jsdoc-syntax">!== </span><span class="jsdoc-keyword">true</span><span class="jsdoc-syntax">) {
-            </span><span class="jsdoc-keyword">var </span><span class="jsdoc-var">fd </span><span class="jsdoc-syntax">= (</span><span class="jsdoc-keyword">new </span><span class="jsdoc-var">FormData</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">this.el.dom</span><span class="jsdoc-syntax">))</span><span class="jsdoc-var">.entries</span><span class="jsdoc-syntax">();
-            </span><span class="jsdoc-keyword">var </span><span class="jsdoc-var">ret </span><span class="jsdoc-syntax">= {};
-            </span><span class="jsdoc-keyword">var </span><span class="jsdoc-var">ent </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">fd.next</span><span class="jsdoc-syntax">();
-            </span><span class="jsdoc-keyword">while </span><span class="jsdoc-syntax">(!</span><span class="jsdoc-var">ent.done</span><span class="jsdoc-syntax">) {
-                </span><span class="jsdoc-var">ret</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">ent.value</span><span class="jsdoc-syntax">[0]] = </span><span class="jsdoc-var">ent.value</span><span class="jsdoc-syntax">[1]; </span><span class="jsdoc-comment">// not sure how this will handle duplicates..
-                </span><span class="jsdoc-var">ent </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">fd.next</span><span class="jsdoc-syntax">();
-            };
-            </span><span class="jsdoc-keyword">return </span><span class="jsdoc-var">ret</span><span class="jsdoc-syntax">;
+            </span><span class="jsdoc-comment">// this relies on a 'recent' version of chrome apparently...
+            </span><span class="jsdoc-keyword">try </span><span class="jsdoc-syntax">{
+                </span><span class="jsdoc-keyword">var </span><span class="jsdoc-var">fd </span><span class="jsdoc-syntax">= (</span><span class="jsdoc-keyword">new </span><span class="jsdoc-var">FormData</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">this.el.dom</span><span class="jsdoc-syntax">))</span><span class="jsdoc-var">.entries</span><span class="jsdoc-syntax">();
+                </span><span class="jsdoc-keyword">var </span><span class="jsdoc-var">ret </span><span class="jsdoc-syntax">= {};
+                </span><span class="jsdoc-keyword">var </span><span class="jsdoc-var">ent </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">fd.next</span><span class="jsdoc-syntax">();
+                </span><span class="jsdoc-keyword">while </span><span class="jsdoc-syntax">(!</span><span class="jsdoc-var">ent.done</span><span class="jsdoc-syntax">) {
+                    </span><span class="jsdoc-var">ret</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">ent.value</span><span class="jsdoc-syntax">[0]] = </span><span class="jsdoc-var">ent.value</span><span class="jsdoc-syntax">[1]; </span><span class="jsdoc-comment">// not sure how this will handle duplicates..
+                    </span><span class="jsdoc-var">ent </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">fd.next</span><span class="jsdoc-syntax">();
+                };
+                </span><span class="jsdoc-keyword">return </span><span class="jsdoc-var">ret</span><span class="jsdoc-syntax">;
+            } </span><span class="jsdoc-keyword">catch</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">e</span><span class="jsdoc-syntax">) {
+
+            }
+
         }
 
 
index 004a9c5..7390bb0 100644 (file)
@@ -1961,8 +1961,8 @@ Roo.MessageBox.confirm("Change requires confirmation",A.result.errorMsg,function
 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]);}}}Roo.each(this.childForms||[],function(f){f.markInvalid(A);});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();}}}}this.resetHasChanged();
-Roo.each(this.childForms||[],function(f){f.setValues(A);f.resetHasChanged();});return this;},getValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());},this);}if(typeof(FormData)!='undefined'&&A!==true){var fd=(new FormData(this.el.dom)).entries();
-var B={};var C=fd.next();while(!C.done){B[C.value[0]]=C.value[1];C=fd.next();};return B;}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());
+Roo.each(this.childForms||[],function(f){f.setValues(A);f.resetHasChanged();});return this;},getValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());},this);}if(typeof(FormData)!='undefined'&&A!==true){try{var fd=(new FormData(this.el.dom)).entries();
+var B={};var C=fd.next();while(!C.done){B[C.value[0]]=C.value[1];C=fd.next();};return B;}catch(e){}}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());
 },this);}var B={};this.items.each(function(f){if(!f.getName()){return;}var v=f.getValue();if(f.inputType=='radio'){if(typeof(B[f.getName()])=='undefined'){B[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()){B[f.name]=f.getRawValue();}B[f.getName()]=v;});return B;},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});Roo.each(this.childForms||[],function(f){f.clearInvalid();});return this;},reset:function(){this.items.each(function(f){f.reset();
 });Roo.each(this.childForms||[],function(f){f.reset();});this.resetHasChanged();return this;},add:function(){this.items.addAll(Array.prototype.slice.call(arguments,0));return this;},remove:function(A){this.items.remove(A);return this;},render:function(){this.items.each(function(f){if(f.isFormField&&!f.rendered&&document.getElementById(f.id)){f.applyTo(f.id);
index c7270b5..89e2463 100644 (file)
@@ -47882,14 +47882,20 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
         
         // use formdata
         if (typeof(FormData) != 'undefined' && asString !== true) {
-            var fd = (new FormData(this.el.dom)).entries();
-            var ret = {};
-            var ent = fd.next();
-            while (!ent.done) {
-                ret[ent.value[0]] = ent.value[1]; // not sure how this will handle duplicates..
-                ent = fd.next();
-            };
-            return ret;
+            // this relies on a 'recent' version of chrome apparently...
+            try {
+                var fd = (new FormData(this.el.dom)).entries();
+                var ret = {};
+                var ent = fd.next();
+                while (!ent.done) {
+                    ret[ent.value[0]] = ent.value[1]; // not sure how this will handle duplicates..
+                    ent = fd.next();
+                };
+                return ret;
+            } catch(e) {
+                
+            }
+            
         }
         
         
index 0d2285d..dd79043 100644 (file)
@@ -25398,14 +25398,20 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
         
         // use formdata
         if (typeof(FormData) != 'undefined' && asString !== true) {
-            var fd = (new FormData(this.el.dom)).entries();
-            var ret = {};
-            var ent = fd.next();
-            while (!ent.done) {
-                ret[ent.value[0]] = ent.value[1]; // not sure how this will handle duplicates..
-                ent = fd.next();
-            };
-            return ret;
+            // this relies on a 'recent' version of chrome apparently...
+            try {
+                var fd = (new FormData(this.el.dom)).entries();
+                var ret = {};
+                var ent = fd.next();
+                while (!ent.done) {
+                    ret[ent.value[0]] = ent.value[1]; // not sure how this will handle duplicates..
+                    ent = fd.next();
+                };
+                return ret;
+            } catch(e) {
+                
+            }
+            
         }
         
         
index 5958546..a9750dd 100644 (file)
@@ -1091,8 +1091,8 @@ Roo.MessageBox.confirm("Change requires confirmation",A.result.errorMsg,function
 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]);}}}Roo.each(this.childForms||[],function(f){f.markInvalid(A);});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();}}}}this.resetHasChanged();
-Roo.each(this.childForms||[],function(f){f.setValues(A);f.resetHasChanged();});return this;},getValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());},this);}if(typeof(FormData)!='undefined'&&A!==true){var fd=(new FormData(this.el.dom)).entries();
-var B={};var C=fd.next();while(!C.done){B[C.value[0]]=C.value[1];C=fd.next();};return B;}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());
+Roo.each(this.childForms||[],function(f){f.setValues(A);f.resetHasChanged();});return this;},getValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());},this);}if(typeof(FormData)!='undefined'&&A!==true){try{var fd=(new FormData(this.el.dom)).entries();
+var B={};var C=fd.next();while(!C.done){B[C.value[0]]=C.value[1];C=fd.next();};return B;}catch(e){}}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getValues());
 },this);}var B={};this.items.each(function(f){if(!f.getName()){return;}var v=f.getValue();if(f.inputType=='radio'){if(typeof(B[f.getName()])=='undefined'){B[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()){B[f.name]=f.getRawValue();}B[f.getName()]=v;});return B;},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});Roo.each(this.childForms||[],function(f){f.clearInvalid();});return this;},reset:function(){this.items.each(function(f){f.reset();
 });Roo.each(this.childForms||[],function(f){f.reset();});this.resetHasChanged();return this;},add:function(){this.items.addAll(Array.prototype.slice.call(arguments,0));return this;},remove:function(A){this.items.remove(A);return this;},render:function(){this.items.each(function(f){if(f.isFormField&&!f.rendered&&document.getElementById(f.id)){f.applyTo(f.id);