Reputation: 3359
I have text field.
<input name="test[1]" id="test" type="text" class="date_select">
and jQuery script:
$(".date_select").datepicker({
dateFormat: 'dd/mm/yy',
defaultValue: 'please select date'
});
When i make click on text field i can see calendar but i can't activate days (nothing happens if i make click on day) and i have this error. SCRIPT5007: Unable to set value of the property 'currentDay': object is null or undefined
Upvotes: 1
Views: 2084
Reputation: 176
I ran into this same issue as well using code that we have to create standard administration screens to maintain database tables. The code is written in ASP and uses Javascript to add additional rows to the screen so that the data can be added into the database. The issue is that the script would create input cells that would always have the same ID as the database column. It appears that the datepicker needs to be used on controls that have unique ID's. To fix this issue I just appended the row number to the control's ID and now the datepicker doesn't get the error.
Upvotes: 0
Reputation: 164
Looks to me that you need to set a default value in the fields and then have a value ... so for your code I'd use datepicker like this ...
<input name="test[1]" id="test" type="text" class="date_select" value="01/01/2014"/>
Alternately use a placeholder like this:
<input name="test[1]" id="test" type="text" class="date_select" placeholder="Please Choose a Date"/>
Upvotes: 1