X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2Fform%2FBasicForm.js;h=130319acb07987d838e46afb576bd42bd0af2b4e;hb=ace3bd1cd175b8285e20933c004e7c5aa826028a;hp=2a6bb59382b5ceee4af4c10818923ce01e5f6496;hpb=978e512d378b6567604bb39734742d64c1c908fc;p=roojs1 diff --git a/Roo/form/BasicForm.js b/Roo/form/BasicForm.js index 2a6bb59382..130319acb0 100644 --- a/Roo/form/BasicForm.js +++ b/Roo/form/BasicForm.js @@ -507,6 +507,9 @@ clientValidation Boolean Applies to submit only. Pass true to call fo for(id in values){ if(typeof values[id] != 'function' && (field = this.findField(id))){ + + + if (field.setFromData && field.valueField && field.displayField && @@ -521,6 +524,9 @@ clientValidation Boolean Applies to submit only. Pass true to call fo sd[field.displayField] = typeof(values[field.name]) == 'undefined' ? '' : values[field.name]; field.setFromData(sd); + } else if (field.inputType && field.inputType == 'radio') { + + field.setValue(values[id]); } else { field.setValue(values[id]); } @@ -546,14 +552,15 @@ clientValidation Boolean Applies to submit only. Pass true to call fo /** * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name * they are returned as an array. - * @param {Boolean} asString + * @param {Boolean} asString (def) * @return {Object} */ - getValues : function(asString){ + getValues : function(asString) + { if (this.childForms) { // copy values from the child forms Roo.each(this.childForms, function (f) { - this.setValues(f.getValues()); + this.setValues(f.getFieldValues()); // get the full set of data, as we might be copying comboboxes from external into this one. }, this); } @@ -586,21 +593,31 @@ clientValidation Boolean Applies to submit only. Pass true to call fo /** * Returns the fields in this form as an object with key/value pairs. * This differs from getValues as it calls getValue on each child item, rather than using dom data. + * Normally this will not return readOnly data + * @param {Boolean} with_readonly return readonly field data. * @return {Object} */ - getFieldValues : function(with_hidden) + getFieldValues : function(with_readonly) { if (this.childForms) { // copy values from the child forms // should this call getFieldValues - probably not as we do not currently copy // hidden fields when we generate.. Roo.each(this.childForms, function (f) { - this.setValues(f.getValues()); + this.setValues(f.getFieldValues()); }, this); } var ret = {}; this.items.each(function(f){ + + if (f.readOnly && with_readonly !== true) { + return; // skip read only values. - this is in theory to stop 'old' values being copied over new ones + // if a subform contains a copy of them. + // if you have subforms with the same editable data, you will need to copy the data back + // and forth. + } + if (!f.getName()) { return; }