TWEagle / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
0 stars 0 forks source link

Value always date today #290

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi.

I have a minor problem in my project.

I have an article/content system, that make good use of your datepicker.
When creating the article, I make use of this form of datapicker to select date 
of publishing: 
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerDefaultToda
y.html

This works like a charm.

And my problem is:
When I go back to edit the article/content with new content, it defaults to 
TodayDate in datepicker input, and I have to re-select the date I want to 
Publish the content.

So you see, I am strugling to retrieve the previous selected date from DB and 
insert it as value to the datepicker (I have the previous date retrieved from 
DB just fine, but if I insert it to the VALUE field of my datepicker input, It 
gets overridden by datepicker.js to TODAY date.

function datepick(field_id,date_start,date_end) {
   $('#'+field_id).datePicker().val(new Date().asString()).trigger('change');
} 

Anyway to make the script look for value field in my input? and use that 
instead of TODAY date?

Thanks for all and any help you could provide me with!

-Tom

Original issue reported on code.google.com by met...@gmail.com on 18 Jun 2011 at 5:35

GoogleCodeExporter commented 9 years ago
By default the script will use the value from the input field!

This bit of code:
.val(new Date().asString()).trigger('change')

Is what is setting the input field to todays date. If you simply miss that out 
then the date picker should act as you expect.

Original comment by kelvin.l...@gmail.com on 19 Jun 2011 at 9:54