我正在尝试创建一个自定义 HTML 5 日期字段以在 laravel 4 框架视图中使用。
{{
Form::macro('datetime', function($field_name)
{
return '';
});
}}
{{ Form::label('event_start', 'Event Date', array('class' => 'control-label')) }}
{{ Form::datetime('event_start') }}
唯一的问题是该值没有被填充,我不知道该怎么做。
我使用此表单来创建和编辑名为“事件”的模型。
我怎样才能填充这个字段的值?
我在 app/start/global.php 中添加了以下内容:
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;
});
但“好方法”是扩展 Form 类并实现您的方法。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)