0
我在Symfony 2中有一个重叠表单的问题。我试图用照片相册创建一个应用程序。 为此,我需要在此过程中创建一个相册并添加他的照片。 照片链接onl一个相册。重叠表格
我认为我的代码是正确的后端,但照片的形式从来没有显示在专辑的形式。我认为问题在于他自己的形式。
照片必须属性:文件和名称。
这是我的表格。
<script type="text/javascript">
$(document).ready(function() {
var $container = $('#thelink_albumbundle_albumtype_photos');
function add_photo() {
index = $container.children().length;
$container.append(
$($container.attr('data-prototype').replace(/\$\$picture\$\$/g, index))
);
}
if($container.children().length == 0)
add_tag();
$('#add_photo').click(function() {
add_photo();
});
});
<form method="post" enctype="multipart/form-data">
{{ form_widget(form) }}
<div id="thelink_albumbundle_albumtype_photos" data-prototype="<div>
<label class=" required">$$photo$$</label>
<div id="thelink_albumbundle_albumtype_photos$$photo$$">
<div><label for="thelink_albumbundle_albumtype_photos$$photo$$_photo"
class=" required">Photo</label>
<input type="file" id="thelink_albumbundle_albumtype_photos$$photo$$_photo"
name="thelink_albumbundle_albumtype[photos][$$photo$$][picture]" required="required"
maxlength="255" value="" /></div></div></div>">
</div>
<br />
<a href="{{ path('TheLinkAlbumBundle_index') }}" title="Retourner sur la liste des Albums">
Annuler la {% if news is defined %}Modification{% else %}Création{% endif %}
</a>
<input type="submit" value="{% if album is defined %}Modifier{% else %}Créer{% endif %} l'Album" />
你有什么想法?或者问题在哪里?