Commit 5ad60e06 by Romain Courteaud

[erp5_web_renderjs_ui] Fix form_validation_error handling

As form_validation_error was not set in render, validation errors were still visible after an edit.
1 parent 021df785
...@@ -82,8 +82,8 @@ ...@@ -82,8 +82,8 @@
options: options, options: options,
view: options.view, view: options.view,
url: url, url: url,
erp5_document: result, erp5_document: JSON.stringify(result),
erp5_form: erp5_form erp5_form: JSON.stringify(erp5_form)
}); });
}); });
}); });
...@@ -104,13 +104,8 @@ ...@@ -104,13 +104,8 @@
page_template_gadget = result; page_template_gadget = result;
var sub_options = options.fg || {}, var sub_options = options.fg || {},
erp5_document = gadget.state.erp5_document, erp5_document = JSON.parse(gadget.state.erp5_document),
erp5_form = gadget.state.erp5_form; erp5_form = JSON.parse(gadget.state.erp5_form);
// Render the page template form
if (options.hasOwnProperty("form_validation_error")) {
erp5_document._embedded._view = options.form_validation_error;
}
loadFormContent(gadget, erp5_document._embedded._view); loadFormContent(gadget, erp5_document._embedded._view);
...@@ -139,7 +134,12 @@ ...@@ -139,7 +134,12 @@
}); });
}) })
.allowPublicAcquisition("displayFormulatorValidationError", function (param_list) { .allowPublicAcquisition("displayFormulatorValidationError", function (param_list) {
return this.changeState({form_validation_error: param_list[0]}); var erp5_document = JSON.parse(this.state.erp5_document);
erp5_document._embedded._view = param_list[0];
// Force refresh
erp5_document._now = Date.now();
return this.changeState({erp5_document: JSON.stringify(erp5_document)});
}); });
}(window, rJS, URI)); }(window, rJS, URI));
\ No newline at end of file \ No newline at end of file
...@@ -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.23027.11225.50944</string> </value> <value> <string>954.44527.39200.57275</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>1476194208.6</float> <float>1476793905.11</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!