|
Rank: Newbie Groups: Member
Joined: 9/28/2009 Posts: 5
|
I need to create a form with two date/time entry fields where the date and time are in seperate fields (customer request). I have not been able to find a way for the time fields to appear blank/empty. How can I do this?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Set the DatePicker's SelectedDate to DateTime.MinValue will make the DatePicker appear blank.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 9/28/2009 Posts: 5
|
That did not work. I still see 12:00 AM.
|
|
Rank: Newbie Groups: Member
Joined: 9/28/2009 Posts: 5
|
Just to be clear, this is a time only field with a PickerFormat of hh:mm tt
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
I see. Please try the following code:
Code: JavaScript
function init_time_picker()
{
eo_GetObject("DatePicker1").setSelectedDate(null);
}
Code: HTML/ASPX
<eo:DatePicker id="DatePicker1" ClientSideOnLoad="init_time_picker" ....>
....
</eo:DatePicker>
This makes the DatePicker to call init_time_picker when it is loaded. The function then call the DatePicker's client side interface to clear the value. Make sure you place the function before the DatePicker. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 9/28/2009 Posts: 5
|
Thanks. That did it.
One reamining issue I'm having is using the RequiredFieldValidator on this control. It is not firing and I believe it may be realted to the PickerFormat defined (hh:mm tt) in relation to the InitialValue I have setup for the validator. The help file indicates that leading and trailing spaces are stripped prior to compare and I tried setting initial value to ":" but that did not work. Ideas?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Please try to use a CustomValidator and see if it works:
Code: JavaScript
function validate_time_picker(sender, e)
{
//Get the text box directly. Note you will need to change
//"DatePicker1" to the client ID of the DatePicker control
var tb = document.getElementById("_eo_DatePicker1_picker");
//Get the textbox value
var text = .value.trim();
//Check if we've got anything
e.IsValid = text != ":";
}
Code: HTML/ASPX
<asp:CustomValidator ClientValidationFunction="validate_time_picker" ...>
</asp:CustomValidator>
We will also look into the control and see if we can make it work with RequiredValidator automatically with time only values. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 9/28/2009 Posts: 5
|
Thanks Much for your assistance. I have everything working now and the date and time controls are functioning as the customer desires.
I was looking specifically for a calendar/date picker control with the support needed for time component. Your product appears to do everything I need and we will likely implement with customer approval. I plan to explore the other controls in the suite, too.
Beyond that, your support has been top notch in timely response, technical knowledge and resolution of the issue.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Glad to hear that and thank you very much for your kind words. Please feel free to let us know if you have any other questions.
|
|
Rank: Newbie Groups: Member
Joined: 12/4/2009 Posts: 5
|
Thanks for the help with the custom validation code. It was just what I was needing to tie the time picker control with the ASP.NET validation control.
|
|