Im trying to create a custom HTML 5 date field for using in a laravel 4 framework view.
{{
Form::macro('datetime', function($field_name)
{
return '';
});
}}
{{ Form::label('event_start', 'Event Date', array('class' => 'control-label')) }}
{{ Form::datetime('event_start') }}
The only problem is the value is not being populated, and i do not know how to do this.
Im using this form to create and edit a model called Event.
how can i populate the value of this field?
I added in app/start/global.php the following:
Form::macro('date', function($name, $value = null, $options = array()) {
$input = '<input type="date" name="' . $name . '" value="' . $value . '"';
foreach ($options as $key => $value) {
$input .= ' ' . $key . '="' . $value . '"';
}
$input .= '>';
return $input;
});
But the "good way" would be to extend the Form class and implement your methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With