How do you get the length of text inside a Mojo text box?
I am trying to set a multiLine TextField with a limit of 150 characters, I tried to do this with a counter, but ran into the problem of being unable to decrease the counter when deleting text or adding the correct number when inserting text, so my new approach was to get the length of the text every time when you click a letter.
I already tried this: (called in attribute charsAllow textField)
if (this.controller.get("mensaje").mojo.getValue().length <= 150) {
return true;
}
this.controller.get("mensaje").mojo.blur();
return false;
but it won’t work .... I debugged and the function exited immediately after the one in bold ... it doesn’t even return trueor false.
I also tried to assign the length value to a variable or assign text to a variable, and then get the length, but nothing.
. getValue().
, , - , textField , .