Nativescript: Question: How to set maxlength on textField?

Created on 8 Jan 2016  路  4Comments  路  Source: NativeScript/NativeScript

How to set maxlength on textField?

android.widget.TextView has an xml declaration android:maxLength. How to convert this to XML UI of nativescript?

question

Most helpful comment

@PieterAelse take a look at this feature request https://github.com/NativeScript/NativeScript/issues/3614.

All 4 comments

Solved it after hitting my head on the keyboard and google

var phoneField = view.getViewById(page,'phoneField');
    var fArray = [];
    fArray[0] = new android.text.InputFilter.LengthFilter(10);
    phoneField.android.setFilters(fArray);

And on iOS?..

@PieterAelse take a look at this feature request https://github.com/NativeScript/NativeScript/issues/3614.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings