Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Extracting method

  • Loading branch information...
commit 16b7b6220a33bb8c16a861e4e32b9f37a675926c 1 parent 6df8c16
@maksar authored
Showing with 22 additions and 17 deletions.
  1. +22 −17 lib/netzke/basepack/form_panel/javascripts/form_panel.js
View
39 lib/netzke/basepack/form_panel/javascripts/form_panel.js
@@ -86,32 +86,37 @@
tbar.doLayout();
},
- onApply: function() {
- if (this.fireEvent('apply', this)) {
+ getValuesToSubmit: function() {
var values = this.getForm().getFieldValues();
for (var fieldName in values) {
- var field = this.getForm().findField(fieldName);
+ var field = this.getForm().findField(fieldName);
- // TODO: move the following checks to the server side (through the :display_only option)
+ // TODO: move the following checks to the server side (through the :display_only option)
- // do not submit values from disabled fields
- if (!field || field.disabled) delete values[fieldName];
+ // do not submit values from disabled fields
+ if (!field || field.disabled) delete values[fieldName];
- // do not submit values from read-only association fields
- if (field
- && field.name
- && field.name.indexOf("__") !== -1
- && (field.readOnly || !field.getStore)
- && (!field.nestedAttribute) // except for "nested attributes"
- ) delete values[fieldName];
+ // do not submit values from read-only association fields
+ if (field
+ && field.name
+ && field.name.indexOf("__") !== -1
+ && (field.readOnly || !field.getStore)
+ && (!field.nestedAttribute) // except for "nested attributes"
+ ) delete values[fieldName];
- // do not submit values from displayfields
- if (field.isXType('displayfield')) delete values[fieldName];
+ // do not submit values from displayfields
+ if (field.isXType('displayfield')) delete values[fieldName];
- // do not submit displayOnly fields
- if (field.displayOnly) delete values[fieldName];
+ // do not submit displayOnly fields
+ if (field.displayOnly) delete values[fieldName];
}
+ return values;
+ },
+
+ onApply: function() {
+ if (this.fireEvent('apply', this)) {
+ var values = this.getValuesToSubmit();
// apply mask
if (!this.applyMaskCmp) this.applyMaskCmp = new Ext.LoadMask(this.bwrap, this.applyMask);
Please sign in to comment.
Something went wrong with that request. Please try again.