How can I catch invalid entries as ValidationError?

4 posts, 0 answers
  1. Jerma
    Jerma avatar
    2 posts
    Member since:
    Dec 2009

    Posted 04 Dec 2009 Link to this post

    Hello,

    I have the following problem: I have a form with a RadDatePicker in it. Everything works fine, but when I enter an invalid date into the entry field of the picker, the date is just resetted or the entry field of the picker is empty. I would prefer to see the defined ErrorTemplate instead.
    I tried to catch this by adding ValidatesOnError to the Binding in the XAML file but it doesnt work.

    So: How can I catch it if the user enters an invalid value to the entry field?

    Best Regards,
    Jerma
  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 09 Dec 2009 Link to this post

    Hello Jerma,

    Can you share a sample of the code that shows the problem you are facing.

    Best wishes,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jane
    Jane avatar
    16 posts
    Member since:
    Jun 2009

    Posted 18 Jan 2010 Link to this post

    We see the same problem for the RadDatePicker
    If the current date is "18/01/2010" and we type in an invalid value such as "18/21/2010" (there is no month will be 21).
    click other control, the RadDatePicker' selection date box will be empty.

    For the RadTimePicker, if we type in invalid value such 6:70 (there is no minute exceed 59)
    click other control, the RadTimePicker's selection time box will be empty.
    is there a way we can indicate some error in UI?
    thx!
    Jane


  5. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 22 Jan 2010 Link to this post

    Hello Jane,

    To achieve such an validation UI logic you need to bind the appropriate properties of the RadDatePicker(SelectedDate) and RadTimePicker (SelectedTime) to a view model data. Also as a simple solution you should define your own validation rule that will be used by the Binding.ValidationRules system. Check the attached example.

    Greetings,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top