Changing the value of a text field while in edit mode


#1

I have a textfield whose value I’ll love to format based on the user input, to the necessary decimal place. E.g when a user enters 1, the value should be 0.1 and when he enters 10 it should be 1.0 e.t.c.

Problem is that it looks like I cant change the value of the textField while in edit mode. Any ideas? My code:

<TextView hint="" text="{{ quantity }}" col="1" decimalPlaces="1" propertyChange="convertToDecimal" id="quantity" keyboardType="number"/>
var formatToDecimal = function (number, dp = 1) {
  var devisor = Math.pow(10, dp);
  var value = number / devisor;
  return number ? value.toFixed(dp) : '';
};

exports.convertToDecimal = function(args) {
    var decimalPlaces = +args.object.decimalPlaces;
    var id = args.object.id;
    var number = +args.object.text;
    dataSource.set(id, formatToDecimal(number, decimalPlaces));

}