Created
March 5, 2012 22:11
-
-
Save stof/1981504 to your computer and use it in GitHub Desktop.
Autocompleter type for Symfony2 forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($) { | |
// initialise the "Select date" link | |
$.datepicker.setDefaults($.datepicker.regional[ "fr" ]); | |
// associate the link with a date picker | |
$('.tolk_date_picker').each(function(){ | |
var self = $(this); | |
self.datepicker({ | |
dateFormat: 'dd/mm/y', | |
changeMonth: true, | |
changeYear: true, | |
showButtonPanel: true, | |
firstDay: 1, | |
monthNamesShort: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'], | |
showOn: "button", | |
buttonImageOnly: true, | |
buttonImage: self.attr('data-datepicker-icon') | |
}); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tolkiendil\AssoBundle\Form\Type; | |
use Symfony\Component\Form\AbstractType; | |
class DatePickerType extends AbstractType | |
{ | |
public function getDefaultOptions(array $options) | |
{ | |
return array( | |
'widget' => 'single_text', | |
'format' => 'dd/MM/yy', | |
'attr' => array( | |
'autocomplete' => 'off', | |
'class' => 'tolk_date_picker', | |
), | |
); | |
} | |
public function getParent(array $options) | |
{ | |
return 'date'; | |
} | |
public function getName() | |
{ | |
return 'tolkiendil_date_picker'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@stof can your recommend the best looking timepicker with bootstrap?