CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Over-ride DatePicker date

Print topic Send  topic

Author Message
tonyk

Posts: 163
Posted: 12/01/2004, 5:10 AM

Hi,
I am using DatePicker for the entry of dates some of which may be in a batch several months behind now. However whenever the user clicks datePicker he is offered the current month to look at.
Looking at the code for datepicker it creates a new instance of the date object based on date(), i.e. always the day on which the user is clicking, the here and now!. How can I over-ride this behaviour so that the user is presented with the historical month in which he is working and in which he will want to select another date?
I tried setting the 'DatePickerObject.selectedDate ' to the date value held in 'DatePickerObject.control' but this did not work, I am assuming that 'control' is the field to which the date is returned.
Any help would be gratefully received.
View profile  Send private message
klwillis


Posts: 428
Posted: 12/03/2004, 1:07 PM

One way to do this is to set the date value to the historical date
you want to start with (taking the historical month, first day and desired
year), within the 'BeforeShow' event for the date control.

Then, let the DatePicker do the rest. ;-)

_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
tonyk

Posts: 163
Posted: 12/04/2004, 9:09 AM

Thanks for the response.

I am aware that the DatePicker (DP) is supposed to pick up the existing value in the designated target field.

I already operate the database in such a way as to copy the date field to the next record in a session by storing it as a session variable which is assigned to the date display field in the 'before show' event. Despite this the DP still picks up today as the date it uses to work with.

I have had various problems with this control.

1- I have set the field to be displayed as longdate, this is also how it is set for the DP and it works fine with this but does not pick up the displayed date when activated.

2- I have several date manipulations to make and do these on later fields that depend on the date selected by the DP control. I have been passing the control's target field (the date display field as a pointer) to a javascript function in which I create a new date object based on the value passed by reference.

sample code

function set_original_date(here,there){
var datin = new Date(here.value);
there.value=datin.getTime(); //converts date to time in ms
var datinx = there.value;

subsequent calculations use datinx being the date_time value in milliseconds.

This works fine for the Longdate format but if I stipulate
"dd/mm/yyyy" as the format for both the date display control and, as follows, in the DP definition in the html
vreg_mn_DatePicker_init_date.format = "dd/mm/yyyy";

then the result of the subsequent actions shows that the DP value is being held as mm/dd/yyyy. Presumably I have to perform some further conversion to obtain my objective as there is another field I wish to use in a similar way where I want the simpler dd/mm/yyyy format.

I have tried removing the control and the datepicker.js file from the project and forcing a rebuild by inserting a new DP control, I get the same result.

I do have many hidden fields on the form and I believe these may interfere. Why that should be I have no idea.

basically I think CCS is great but I do feel the DP control is decidedly flaky, I am currently looking at alternative datepicker type controls, or is there a new version in the pipeline.

Also I have not been able to find any good documentation on the functions available for the dp object short of stomping through the js file.

End of rant!!

Any advice gratefull received:)

Tony
View profile  Send private message
klwillis


Posts: 428
Posted: 12/04/2004, 11:24 AM

Do you have any controls on the form which happen
to have the same name?

I had a similar problem with a session variable and a page
control which had the same name, the page control data kept
getting wiped out.

Other then that, hopefully some one else can provide you with
better help in solving this one.

_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
klwillis


Posts: 428
Posted: 12/04/2004, 11:25 AM

What I meant was controls that conflict with global or session
variables.

Quote klwillis:
Do you have any controls on the form which happen
to have the same name?

I had a similar problem with a session variable and a page
control which had the same name, the page control data kept
getting wiped out.

Other then that, hopefully some one else can provide you with
better help in solving this one.


_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
tonyk

Posts: 163
Posted: 12/04/2004, 11:30 AM

No there are no other controls or session variables that share a name with each other, even those declared within the scope of js functions all have different names. Good idea to check though.
Tony
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.