Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Value in jQuery datepicker

552129Jun 18 2010
Hi

I have found a date picker there use jQuery, it works almost....

I use the date picker for item: #P1_HIREDATE'

In the java script i want to get the values in var disabledDays from the database. I have tryed to put the values in to a page item P1_TEST (set the value as default value ["2-21-2010","2-24-2010","2-27-2010","2-28-2010","3-3-2010","3-17-2010","4-2-2010","4-3-2010","4-4-2010","6-24-2010"]) and used $v('P1_TEST') but the date picker does not get the values of item P1_TEST??

I have placed the javascript in the Region Header of the region. I think it someting about the script are run before P1_TEST have values??
Any ideas?

<script type="text/javascript">
/* create an array of days which need to be disabled */
var disabledDays = ["2-21-2010","2-24-2010","2-27-2010","2-28-2010","3-3-2010","3-17-2010","4-2-2010","4-3-2010","4-4-2010","6-24-2010"];

/* utility functions */
function nationalDays(date) {
var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
//console.log('Checking (raw): ' + m + '-' + d + '-' + y);
for (i = 0; i < disabledDays.length; i++) {
if($.inArray((m+1) + '-' + d + '-' + y,disabledDays) != -1 || new Date() > date) {
//console.log('bad: ' + (m+1) + '-' + d + '-' + y + ' / ' + disabledDays);
return [false];
}
}
//console.log('good: ' + (m+1) + '-' + d + '-' + y);
return [true];
}
function noWeekendsOrHolidays(date) {
var noWeekend = jQuery.datepicker.noWeekends(date);
return noWeekend[0] ? nationalDays(date) : noWeekend;
}

/* create datepicker */
jQuery(document).ready(function() {
jQuery('#P1_HIREDATE').datepicker({
minDate: new Date(2010, 0, 1),
maxDate: new Date(2010, 5, 31),
dateFormat: 'DD, MM, d, yy',
constrainInput: true,
beforeShowDay: noWeekendsOrHolidays
});
});

</script>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 16 2010
Added on Jun 18 2010
0 comments
707 views