2016-10-10 23 views
0

我想這相當於:周選擇器symfony的形式

<input type="week" (...)> 

與Symfony的形式。

我試試這個:

{{ form_widget(form.date, {'attr': {'type': 'week'}}) }} 

,但它不工作,我得到這個:

<input type="date" (...) required="required" class="form-control" type="week" /> 

我用這個類型:

DateType::class 

感謝。

+0

[Symfony form week picker]可能的重複(https://stackoverflow.com/questions/39287340/symfony-form-week-picker) –

回答

0

您使用的方法{'attr': {'type': 'week'}}只會插入另一個類型屬性。問題在於DateType :: class。雖然我看着它,但我很確定symfony目前不支持<input type= "week" />。或者在現在的版本中,目前在symfony中沒有可用的WeekType::class