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

Required field validator not firing on date picker

9 Answers 929 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Brendan Vogt
Top achievements
Rank 1
Brendan Vogt asked on 27 Aug 2008, 10:32 AM
Hi,

I have a date picker control with a required field validator control.  When the page loads the date picker's textbox is empty.  So I select a date, and then delete the date and move the focus to another control on the page, but the required field validator does not fire.  Can some one please explain why?

Brendan

9 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 Aug 2008, 11:10 AM
Hi Brendan,

I tried to implement the same scenario on my end and it is working as expected. Have you set the ErrorMessage property for the RequiredFieldValidator?

Here is the aspx code I tried:
<telerik:RadDatePicker ID="RadDatePicker1" runat="server"
      <Calendar runat="server"  Font-Size="Smaller"  ></Calendar
  </telerik:RadDatePicker> 
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Enter a Date" ControlToValidate="RadDatePicker1" ></asp:RequiredFieldValidator> 
       


Regards
Princy.
0
Maria Ilieva
Telerik team
answered on 27 Aug 2008, 11:14 AM
Hello Brendan,

I also tested the same scenario and, as Princy mentioned, it works as expected. Please set the ErrorMessage property and let us know how it goes.

Sincerely yours,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Brendan Vogt
Top achievements
Rank 1
answered on 27 Aug 2008, 11:15 AM
Here is my code:

<radcln:RadDatePicker
   ID="rdpExportEndDate"
   Width="120"
   runat="server">
</radcln:RadDatePicker>
<asp:RequiredFieldValidator
   ID="rfvExportEndDate"
   ControlToValidate="rdpExportEndDate"
   Display="Dynamic"
   ErrorMessage="Required"
   runat="server">
</asp:RequiredFieldValidator>

This doesn't fire at all.
0
Brendan Vogt
Top achievements
Rank 1
answered on 27 Aug 2008, 11:20 AM
Hi,

I took his code, and added it to a new page, I just put it in a form tag.  That's all.  I ran the page and it does not trigger.  Is there some sort of page property that I need to set?

Brendan
0
Maria Ilieva
Telerik team
answered on 27 Aug 2008, 12:03 PM
Hello Brendan,

Please find attached a sample runnable project which works as expected. Test it on your aide and let me know what the difference in your case is.

Sincerely yours,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Brendan Vogt
Top achievements
Rank 1
answered on 27 Aug 2008, 12:51 PM
Thanks but that zipped file is too big for me to download.  Can you maybe exclude the dll files please?  I am using Q1 2007.
0
Maria Ilieva
Telerik team
answered on 27 Aug 2008, 01:12 PM
Hi Brendan,

Please find the attached project. Add the needed dll's and let us know how it goes.

Greetings,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Brendan Vogt
Top achievements
Rank 1
answered on 28 Aug 2008, 06:30 AM
Hi,

I had a look at the code.  The required field validator only fires when the button is clicked and there is no date.  My scenario is different.  When there is a date and the user clears the date and goes to another control, then it should fire, not only when the button is clicked.

Brendan
0
Maria Ilieva
Telerik team
answered on 28 Aug 2008, 07:34 AM
Hello Brendan,

The default behaviour of the Validator control is to to fire validation on postback. I you add regular asp control instead of RadDatePicker the application will behaves in the same way. Please review the following topic which elaborates on Validating control on lost focus event

Kind regards,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Calendar
Asked by
Brendan Vogt
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Maria Ilieva
Telerik team
Brendan Vogt
Top achievements
Rank 1
Share this question
or