Commit 5c7b1534 authored by Roque's avatar Roque

erp5_officejs: avoid to redirect after submit in form view

parent fb7130a4
......@@ -135,7 +135,30 @@
.declareMethod("triggerSubmit", function (argument_list) {
return this.getDeclaredGadget('fg')
.push(function (gadget) {
return gadget.triggerSubmit(argument_list);
if (gadget.state.save_action !== true) {
return;// If not action is defined on form, do nothing
}
var action = gadget.state.erp5_document._embedded._view._actions.put;
return gadget.getDeclaredGadget("erp5_form")
.push(function (sub_gadget) {
return sub_gadget.checkValidity();
})
.push(function (is_valid) {
if (!is_valid) {
return null;
}
return gadget.getContent();
})
.push(function (content_dict) {
if (content_dict === null) {
return;
}
return gadget.submitContent(
gadget.state.jio_key,
action.href,
content_dict
);
}); // page form handles failures well enough
});
})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment