Welcome Guest Search | Active Topics | Sign In | Register

DatePicker SelectedDateString value in jscript Options
FPATER
Posted: Wednesday, October 21, 2009 3:43:36 PM
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';
eo_support
Posted: Wednesday, October 21, 2009 4:21:05 PM
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.aspx

Generally you should not try to use document.getElementById to access the underlying DHTML elements directly.

Thanks!
FPATER
Posted: Wednesday, October 21, 2009 5:26:27 PM
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.

eo_support
Posted: Wednesday, October 21, 2009 5:33:26 PM
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.aspx

It 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
FPATER
Posted: Thursday, October 22, 2009 8:58:56 AM
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.
eo_support
Posted: Thursday, October 22, 2009 9:09:08 AM
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
FPATER
Posted: Thursday, October 22, 2009 9:19:18 AM
Rank: Member
Groups: Member

Joined: 3/11/2009
Posts: 24
Thanks.


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.