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

[Solved] DatePicker with Custom Validator works...kind of...

2 Answers 139 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ryan
Top achievements
Rank 2
Ryan asked on 30 Nov 2011, 07:12 PM
Hey everyone,

So here is the situation...  I have a View which has two dates on it.  For this discussion, they are Start Date and End Date.  On the model they look like Model.StartDate and Model.EndDate (or m => m.StartDate and m => m.EndDate).  I wrote a custom validator that validates the End Date occurs AFTER the Start Date.

This validator works perfectly if used with plain text boxes.  It also works with the Telerik ASP.NET MVC Date Picker (latest build) if I click the Submit button.  After the button click, client side validation on these date pickers work as well.  HOWEVER, Client Side validation on these date pickers with my custom validator does NOT work prior to the button click.  As soon as the page validation is executed the client side validation works perfectly and a subsequent button click / view validation works.

Again, the scenarios...
- Custom validator to test End Date is > Start Date - works with text boxes.
When using Html.Telerik.DatePickerFor(...)...
- Action - Setting focus away from the date picker -
----- WORKS if a the Save/Submit button has been clicked and the entire page validation is fired.
----- Does NOT work if the Save/submit button has not been clicked and the entire page validation has not yet occured.


Anyone else have this problem or is able to reproduce?

2 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 05 Dec 2011, 03:37 PM
Hello Ryan,

 
This is not a known issue. Could you please send us a simple test project, which shows the implementation of the custom validator? Thus I will be able to observe the problem locally and advice you further.

Kind regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Vijay
Top achievements
Rank 1
answered on 12 Dec 2012, 08:50 AM
Hi Ryan,

As you described, I have the same issue with @Html.Telerik().DatePickerFor(..).

My client validation works fine with TextBoxFor but when I use Telerik().DatePickerFor(), it only works when I click on 'Submit' button..I meant, it happens after post back to server... it should work at client.. as like for TextBoxFor..

Let's hope, we will get some help from the telerik support team..

Please find the test project attached here.


Thanks,
Vijay
Tags
Date/Time Pickers
Asked by
Ryan
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Vijay
Top achievements
Rank 1
Share this question
or