Focus Telerik widget on validation error

1 Answer 46 Views
AutoComplete ComboBox DateInput DatePicker DateRangePicker DateTimePicker DropDownList General Discussions MaskedTextBox MultiColumnComboBox MultiSelect NumericTextBox TextArea TextBox TimePicker
Claudio
Top achievements
Rank 2
Bronze
Bronze
Iron
Claudio asked on 10 Oct 2024, 07:53 AM

Hi, my goal is validate a form and focus telerik widget with validation errors.  

 

Now i can find the element search for class "k-invalid" but how to get the widget reference so i can call the FocusAsync() method?

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Hristian Stefanov
Telerik team
answered on 14 Oct 2024, 02:40 PM

Hi Claudio,

I can confirm that you can easily focus on the first invalid input without needing to use a template and the FocusAsync() method. This can be achieved with a small JavaScript function called within the OnInvalidSubmit event handler. I've prepared an example for you here: REPL link.

Please run and test it to see if it meets your expectations.

Regards,
Hristian Stefanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
AutoComplete ComboBox DateInput DatePicker DateRangePicker DateTimePicker DropDownList General Discussions MaskedTextBox MultiColumnComboBox MultiSelect NumericTextBox TextArea TextBox TimePicker
Asked by
Claudio
Top achievements
Rank 2
Bronze
Bronze
Iron
Answers by
Hristian Stefanov
Telerik team
Share this question
or