symfony - FileType picker button
问题描述
This is really basic...but I don't find where the documentation allow the modification
I've a form with a FileType.
It looks like this:
Label ------File Space-------- Browse Button
I've been able to change the label text. But I can't find how to specify the Browse button texte.
$form = $this->createFormBuilder()
->add('importer', FileType::class, ['label' => 'Import CSV'])
->add('import', SubmitType::class, ['label' => 'Import'])
->getForm();
When I look into the FileType options I can't find what I'm looking for.
Thanks.
解决方案
我认为您可以尝试使用这样的attr
选项:
$form = $this->createFormBuilder()
->add('importer', FileType::class, [
'label' => 'Import CSV',
'attr' => ['placeholder' => 'Custom button name'],
])
->add('import', SubmitType::class, ['label' => 'Import'])
->getForm();
推荐阅读
- networking - 远程系统的最大响应 PDU 大小
- python - SQLalchemy 在多对多关系中设置约束
- jpa-2.0 - 带有 JPA 标准 API 的 WHERE 子句中的 SQL“行值”语法
- training-data - 如何使用 ft.dfs 结果加入测试集?
- html - 曲线形状的 div 边框
- sparql - 使用 Wikidata 查询服务快速查找发布日期
- html - 为什么样式为“inline-block”的表单在“div”中有效,但在“p”中无效?
- project-reactor - Kafka 反应器消费者 API
- nltk - 从 nltk tree.fromString 生成的树在作品中不显示左右括号
- java - 为什么拒绝证书 Java?