Welcome Guest Search | Active Topics | Sign In | Register

Blank Time value in DatePicker Options
KentTushaus
Posted: Monday, September 28, 2009 10:10:38 AM
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?
eo_support
Posted: Monday, September 28, 2009 10:18:08 AM
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!
KentTushaus
Posted: Monday, September 28, 2009 10:31:51 AM
Rank: Newbie
Groups: Member

Joined: 9/28/2009
Posts: 5
That did not work. I still see 12:00 AM.
KentTushaus
Posted: Monday, September 28, 2009 10:42:58 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
eo_support
Posted: Monday, September 28, 2009 10:54:06 AM
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!
KentTushaus
Posted: Monday, September 28, 2009 3:58:24 PM
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?

eo_support
Posted: Monday, September 28, 2009 4:36:36 PM
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!
KentTushaus
Posted: Thursday, October 1, 2009 4:10:20 PM
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.


eo_support
Posted: Thursday, October 1, 2009 4:13:54 PM
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.
Larry
Posted: Friday, December 11, 2009 3:44:59 PM
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.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.