Datepicker in cake php used for displaying its content in date formats. The widget used in jquery for making it stylish and feel easy to user for displaying the date, minth and years. This will expalins as follow, User can use this line of code by passing the id of the input box to the datepicker function and give new look to it.By default, it is open in calender a small overlay when a user need to display it through inputbox.
Source code for displaying date:
JavaScript Code:
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
PHP code:
<?php echo $this->Form->input('date_of_birth',array('name'=>'date_of_birth','id'=>'datepicker','placeholder'=>'Date of Birth'))?>
<img src="<?php echo $this->webroot;?>images/cal.png" class="cal">
$( ".selector" ).datepicker({
monthNames: [ "Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December" ]
});
0 Comment(s)