0
我有這種簡單的表單,我需要一個字段的自定義模板才能在<input>
標記旁邊呈現某些內容。因爲我不會需要這個其他地方,我想我應該把它正好在相同的模板形式類似建議here:嵌入式表單模板/主題呈現宣告位置
{% form_theme form _self %}
{% block text_widget %}
{{ block('form_widget_simple') }}
something
{% endblock %}
{{ form_start(form) }}
{{ form_widget(form) }}
{{ form_end(form) }}
這幾乎是整個模板(與AJAX使用,因此沒有周圍的標記)。
現在的問題是,「東西」會在聲明塊text_widget
的輸出開頭正確顯示,正如任何其他塊一樣。它的形式呈現精細旁邊<input>
:
something
<form name="form" method="post" action="">
<table id="form"><tr>
<td> <label for="form_Search" class="required">Search</label></td>
<td> <input type="text" id="form_Search" name="form[Search]" required="required" autofocus="autofocus" />
something
</td>
</tr><tr style="display: none">
<td colspan="2"><input type="hidden" id="form__token" name="form[_token]" value="dUwdoiz9vo1TJTRjvyUcz9Rwd-D7pTvqUH-R0zCtg28" /></td>
</tr></table>
</form>
這顯然使得內嵌的主題化完全無法使用,所以我想我可能做錯了什麼......
如何擺脫多餘的「開始時」是什麼?