Commit 660050d4 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Allow to submit the form action from textarea

parent 13c77d52
...@@ -19,22 +19,32 @@ ...@@ -19,22 +19,32 @@
return this.changeState(state_dict); return this.changeState(state_dict);
}) })
.declareMethod('updateDOM', function () { .declareMethod('updateDOM', function (modification_dict) {
var element = this.element, var element = this.element,
gadget = this, gadget = this,
url; url,
if (gadget.state.editable) { result;
url = 'gadget_html5_textarea.html';
if (modification_dict.hasOwnProperty('editable')) {
if (gadget.state.editable) {
url = 'gadget_html5_textarea.html';
} else {
url = 'gadget_html5_element.html';
}
result = this.declareGadget(url, {scope: 'sub'})
.push(function (input) {
// Clear first to DOM, append after to reduce flickering/manip
while (element.firstChild) {
element.removeChild(element.firstChild);
}
element.appendChild(input.element);
return input;
});
} else { } else {
url = 'gadget_html5_element.html'; result = this.getDeclaredGadget('sub');
} }
return this.declareGadget(url, {scope: 'sub'}) return result
.push(function (input) { .push(function (input) {
// Clear first to DOM, append after to reduce flickering/manip
while (element.firstChild) {
element.removeChild(element.firstChild);
}
element.appendChild(input.element);
return input.render(gadget.state); return input.render(gadget.state);
}); });
}) })
......
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1475163059.77</float> <float>1475764759.74</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
.declareMethod('updateDOM', function () { .declareMethod('updateDOM', function () {
var textarea = this.element.querySelector('textarea'); var textarea = this.element.querySelector('textarea');
// textarea.setAttribute('value', this.state.value);
textarea.value = this.state.value; textarea.value = this.state.value;
textarea.setAttribute('name', this.state.name); textarea.setAttribute('name', this.state.name);
textarea.setAttribute('title', this.state.title); textarea.setAttribute('title', this.state.title);
......
...@@ -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.22955.35469.52377</string> </value> <value> <string>954.27370.32393.51592</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>1475499846.91</float> <float>1475769541.61</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