简体   繁体   English

Symfony2嵌入式表单标签

[英]Symfony2 embedded form labels

I have created embedded form for file upload, but when I add new file upload input element, it adds label "label__" 我已经创建了用于文件上传的嵌入式表单,但是当我添加新的文件上传输入元素时,它会添加标签“ label__”

在此处输入图片说明

which is annoying, I would like to remove it. 这很烦人,我想将其删除。 I have tried removing it from JavaScript by modifying code from http://symfony.com/doc/current/cookbook/form/form_collections.html , from 我尝试通过修改http://symfony.com/doc/current/cookbook/form/form_collections.html中的代码,从JavaScript中将其删除

newForm = prototype.replace(/__name__/g, ''),

to

newForm = prototype.replace(/__name__label__/g, ''),

But then it stopped working (only the last file was being uploaded). 但随后它停止工作(仅上传了最后一个文件)。 I can of course hide it with css, but I would like to remove it, or change it to something meaningful, how can I do that? 我当然可以用CSS隐藏它,但是我想将其删除或将其更改为有意义的东西,我该怎么做?

I had the same problem and I changed this part of js to: 我遇到了同样的问题,并将js的这一部分更改为:

prototype = prototype.replace(/<label(.*)__name__label__<\/label>/i, '');
var newForm = prototype.replace(/__name__/g,index);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM