Commit 9441a2d2 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Add getTextContent for checkbox field

parent 6374b820
......@@ -37,6 +37,13 @@
return {};
})
.declareMethod('getTextContent', function () {
return this.getDeclaredGadget('sub')
.push(function (gadget) {
return gadget.getTextContent();
});
})
.declareMethod('checkValidity', function () {
if (this.state.editable) {
return this.getDeclaredGadget('sub')
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.35656.703.56354</string> </value>
<value> <string>954.35756.30335.63129</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476262104.61</float>
<float>1476267648.2</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP */
/*jslint indent: 2, maxerr: 3 */
/*jslint indent: 2, maxerr: 3, maxlen: 80 */
(function (window, rJS, RSVP) {
"use strict";
......@@ -80,6 +80,17 @@
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")
.declareMethod('checkValidity', function () {
var result = this.element.querySelector('input').checkValidity();
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.35694.60208.56524</string> </value>
<value> <string>954.35751.28793.55927</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476264002.68</float>
<float>1476267355.19</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