Commit 7c8d7000 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_web: Skip validation on raw inputs

This prevent the field be named twice if the user selects raw parameter edition. In such case, we let the erp5 validate it instead.
parent 4799e5a6
......@@ -10,12 +10,19 @@
gk.declareMethod('getContent', function () {
var g = this;
console.log("hey cousous");
return g.getDeclaredGadget("parameter")
.push(function(gadget) {
var field_your_instance_xml = gadget.__element.querySelector('textarea[name=field_your_instance_xml]');
if (field_your_instance_xml !== null) {
return "SKIP";
}
return gadget.processValidation(g.options.json_url);
})
.push(function (xml_result) {
if (xml_result === "SKIP") {
/* The raw parameters are already on the request */
return {};
}
return {"field_your_instance_xml": xml_result};
})
.fail(function (e) {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>941.49054.39000.10274</string> </value>
<value> <string>950.63528.40790.54084</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1426725223.8</float>
<float>1462378412.41</float>
<string>UTC</string>
</tuple>
</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