Commit b1b7c745 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Add getTextContent for checkbox field

parent c39fd87d
...@@ -37,6 +37,13 @@ ...@@ -37,6 +37,13 @@
return {}; return {};
}) })
.declareMethod('getTextContent', function () {
return this.getDeclaredGadget('sub')
.push(function (gadget) {
return gadget.getTextContent();
});
})
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
if (this.state.editable) { if (this.state.editable) {
return this.getDeclaredGadget('sub') return this.getDeclaredGadget('sub')
......
...@@ -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.35656.703.56354</string> </value> <value> <string>954.35756.30335.63129</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>1476262104.61</float> <float>1476267648.2</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP */ /*global window, rJS, RSVP */
/*jslint indent: 2, maxerr: 3 */ /*jslint indent: 2, maxerr: 3, maxlen: 80 */
(function (window, rJS, RSVP) { (function (window, rJS, RSVP) {
"use strict"; "use strict";
...@@ -80,6 +80,17 @@ ...@@ -80,6 +80,17 @@
return result; return result;
}) })
.declareMethod('getTextContent', function () {
var result,
input = this.element.querySelector('input');
if (this.state.type === 'checkbox') {
result = (input.checked ? '' : '');
} else {
result = input.value;
}
return result;
})
.declareAcquiredMethod("notifyValid", "notifyValid") .declareAcquiredMethod("notifyValid", "notifyValid")
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
var result = this.element.querySelector('input').checkValidity(); var result = this.element.querySelector('input').checkValidity();
......
...@@ -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.35694.60208.56524</string> </value> <value> <string>954.35751.28793.55927</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>1476264002.68</float> <float>1476267355.19</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