Permalink
Browse files

Fixed: If FormPanel contains upload field then it closes on submit ev…

…en if underlying model have validations errors.
  • Loading branch information...
Alexander Gulko
Alexander Gulko committed Jul 4, 2011
1 parent 04bbd7c commit e0f373ec400dcb849698536b630a0518bcb55064
@@ -100,6 +100,7 @@
// 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"
@@ -129,9 +130,10 @@
success: function(form, action) {
try {
var respObj = Ext.decode(action.response.responseText);
+ var success = respObj.success;
delete respObj.success;
this.bulkExecute(respObj);
- this.fireEvent('submitsuccess');
+ if (success) this.fireEvent('submitsuccess');
}
catch(e) {
Ext.Msg.alert('File upload error', action.response.responseText);
@@ -59,13 +59,13 @@ def netzke_submit(params)
success = create_or_update_record(data)
if success
- {:set_form_values => js_record_data, :set_result => true}
+ {:set_form_values => js_record_data, :set_result => true, :success => true}
else
# flash eventual errors
@record.errors.to_a.each do |msg|
flash :error => msg
end
- {:feedback => @flash, :apply_form_errors => build_form_errors(record)}
+ {:feedback => @flash, :apply_form_errors => build_form_errors(record), :success => false}
end
end

0 comments on commit e0f373e

Please sign in to comment.