This is a migrated thread and some comments may be shown as answers.

Combobox Maxlength

1 Answer 1065 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Iron
Joel asked on 16 Apr 2018, 06:08 PM
In Kendo UI for Angular, how do you set maxlength for the input element?

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 17 Apr 2018, 10:08 AM
Hello Joel,

The ComboBox component will respect a max length form validation (but currently there is no built-in support for restricting the user's input to a certain length).

To provide the DOM maxlength attribute on the actual INPUT element, used internally by the ComboBox, you will need to access it and add the attribute programmatically, e.g.:

public ngAfterViewInit() {
      this.combo.searchbar.input.nativeElement.setAttribute('maxlength', this.maxLength)
    }

Here is a sample implementation of the described approach:

https://plnkr.co/edit/fSxGig7Bfdr63JaeKv03?p=preview

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
General Discussions
Asked by
Joel
Top achievements
Rank 1
Iron
Answers by
Dimiter Topalov
Telerik team
Share this question
or