Commit becaeaf4 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Do not try to submit if the form doesn't have action

parent b3b4f88b
...@@ -29,8 +29,17 @@ ...@@ -29,8 +29,17 @@
editable: options.editable, editable: options.editable,
erp5_document: options.erp5_document, erp5_document: options.erp5_document,
form_definition: options.form_definition, form_definition: options.form_definition,
erp5_form: options.erp5_form || {} erp5_form: options.erp5_form || {},
new_content_action: false,
delete_action: false,
save_action: false
}; };
if (options.erp5_document._embedded._view._actions !== undefined) {
if (options.erp5_document._embedded._view._actions.put !== undefined) {
state_dict.save_action = true;
}
}
return this.changeState(state_dict); return this.changeState(state_dict);
}) })
...@@ -52,14 +61,7 @@ ...@@ -52,14 +61,7 @@
// render the header // render the header
.push(function () { .push(function () {
var new_content_action = form_gadget.state.erp5_document._links.action_object_new_content_action, var new_content_action = form_gadget.state.erp5_document._links.action_object_new_content_action,
delete_action = form_gadget.state.erp5_document._links.action_object_delete_action, delete_action = form_gadget.state.erp5_document._links.action_object_delete_action;
save_action = false;
if (form_gadget.state.erp5_document._embedded._view._actions !== undefined) {
if (form_gadget.state.erp5_document._embedded._view._actions.put !== undefined) {
save_action = true;
}
}
if (new_content_action !== undefined) { if (new_content_action !== undefined) {
new_content_action = form_gadget.getUrlFor({command: 'change', options: {view: new_content_action.href, editable: true}}); new_content_action = form_gadget.getUrlFor({command: 'change', options: {view: new_content_action.href, editable: true}});
...@@ -78,7 +80,6 @@ ...@@ -78,7 +80,6 @@
new_content_action, new_content_action,
form_gadget.getUrlFor({command: 'history_previous'}), form_gadget.getUrlFor({command: 'history_previous'}),
delete_action, delete_action,
save_action,
calculatePageTitle(form_gadget, form_gadget.state.erp5_document) calculatePageTitle(form_gadget, form_gadget.state.erp5_document)
]); ]);
}) })
...@@ -90,9 +91,9 @@ ...@@ -90,9 +91,9 @@
selection_url: all_result[3], selection_url: all_result[3],
delete_url: all_result[4], delete_url: all_result[4],
cut_url: "", cut_url: "",
page_title: all_result[6] page_title: all_result[5]
}; };
if (all_result[5] === true) { if (form_gadget.state.save_action === true) {
header_dict.save_action = true; header_dict.save_action = true;
} }
return form_gadget.updateHeader(header_dict); return form_gadget.updateHeader(header_dict);
...@@ -100,6 +101,12 @@ ...@@ -100,6 +101,12 @@
}) })
.onEvent('submit', function () { .onEvent('submit', function () {
if (this.state.save_action !== true) {
// If not action is defined on form, do nothing
return;
}
var form_gadget = this, var form_gadget = this,
erp5_form, erp5_form,
form_id = this.state.erp5_document._embedded._view.form_id, form_id = this.state.erp5_document._embedded._view.form_id,
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>954.5679.65163.53162</string> </value> <value> <string>954.25820.35404.6229</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1475668916.27</float> <float>1475671542.46</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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