forked from verdnatura/hedera-web
39 lines
615 B
JavaScript
39 lines
615 B
JavaScript
|
Htk.Entry = new Class
|
||
|
({
|
||
|
Extends: Htk.Field
|
||
|
,Tag: 'htk-entry'
|
||
|
|
||
|
,initialize: function (props)
|
||
|
{
|
||
|
this.parent (props);
|
||
|
this.createElement ('input');
|
||
|
this.node.type = 'text';
|
||
|
this.node.addEventListener ('change', this.changed.bind (this));
|
||
|
}
|
||
|
|
||
|
,changed: function (event)
|
||
|
{
|
||
|
var newValue;
|
||
|
|
||
|
if (this.node.value == '')
|
||
|
newValue = null;
|
||
|
else
|
||
|
newValue = this.node.value;
|
||
|
|
||
|
this.valueChanged (newValue);
|
||
|
}
|
||
|
|
||
|
,putValue: function (value)
|
||
|
{
|
||
|
if (!value)
|
||
|
this.node.value = '';
|
||
|
else
|
||
|
this.node.value = value;
|
||
|
}
|
||
|
|
||
|
,setEditable: function (editable)
|
||
|
{
|
||
|
this.node.readOnly = !editable;
|
||
|
}
|
||
|
});
|