|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
I'm setting the SelectedDateString value in javascript and the value is not showing in the DAtePicker control. What is the equivalent in javascript?
Code: JavaScript
var odateFrom = document.getElementById('_eo_' + '<%=dtpFromDate.ClientID%>' + '_picker');
var odateTo = document.getElementById('_eo_' + '<%=dtpToDate.ClientID%>' + '_picker');
odateFrom.SelectedDateString = "01/01/2009';
odateTo.SelectedDateString = '10/21/2009';
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You will need to call eo_GetObject to get the DatePicker object, then call setSelectedDate to set the date. Please see here for more details: http://doc.essentialobjects.com/library/1/clientapi_howto.aspxGenerally you should not try to use document.getElementById to access the underlying DHTML elements directly. Thanks!
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
I try it and still doesn't show it.
var odateFrom = eo_GetObject("dtpFromDate"); var odateTo = eo_GetObject("dtpToDate"); var MasterDate = new Date(); odateFrom.setSelectedDate = MasterDate;
as a string doesn't also work.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Here is the reference for setSelectedDate: http://doc.essentialobjects.com/library/1/jsdoc.public.calendar.setselecteddate.aspxIt is a method, not a property. So you need to call it, not set it. None of our client side objects exposes any property. It's always a method. The method does take a Date, not a string. Thanks
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
Thanks. It works. Now, you mention to use the eo_GetObject insted of using the document.getElementById to reference an object. I was doing:
Code: JavaScript
var odateFromImg = document.getElementById('_eo_' + '<%=dtpFromDate.ClientID%>' + '_popupimg');
var odateToImg = document.getElementById('_eo_' + '<%=dtpToDate.ClientID%>' + '_popupimg');
odateFromImg.disabled = true;
odateToImg.disabled = true;
and the control and calendar button become disable. If I use
Code: JavaScript
var odateFrom = eo_GetObject("dtpFromDate");
var odateTo = eo_GetObject("dtpToDate");
odateFrom.disabled = true;
odateTo.disabled = true;
the datepicker doesn't get disable.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We do not officially support disabling the DatePicker on the client side. The first approach is a valid workaround in the current build, but we can not guarantee that it will continue to work in future builds because it is not through our documented interface.
The second approach does not exist. All supported methods are explicitly listed in the document. So you can not find anything there, then either it does not exist, or it is not intended for you to use (such as we may change it later).
Also as mentioned in our previous reply, all our interfaces are methods. So it will never work if you try to set a property on our client side object (please do not confuse our client side object with DHTML objects. Our client side objects are returned by eo_GetObject, DHTML objects are returned by document.getElementById).
Hope this clears up.
Thanks
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
Thanks.
|
|