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

Validation (Empty - Invalid)

1 Answer 108 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 19 May 2008, 01:25 PM
Hello!

I need to create a validator that fires if i enter an invalid string (e.g. "abcd")
but does not fire if i enter an empty string.

I know that the SelectionChanged Event fires only if a valid date is entered.
Thus if i create a CustomValidator e.Value is empty even if an invalid string is entered e.g. "abcd".

I tried the approach with clientside validation but in this case the args.InputText Property of the OnError event  is "UNDEFINED". (the event is fired but args.InputText is undefined)

For me the best case would be the validation would work server side. (so i am not looking for a javascript solution to my problem).

thx in advance
Markus



1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 22 May 2008, 06:30 AM
Hello Markus,

Since in many cases the control will have some values entered in it, server side validation may not be appropriate. You can use client side handlers to determine the input. The onError hanler gives additional information as to the cause of the error - whether it was parsing, or range issue. the onValueChanging/onBlur methods are two other options. By using any combination of these options, you can create very flexible validation.
Alternatively, you can use the beforementioned approaches to simply clear the text in the control, which would give you the chance to use a required field validator for example.
I hope one of these options is suitable for you.

All the best,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Calendar
Asked by
Markus
Top achievements
Rank 2
Answers by
Yavor
Telerik team
Share this question
or