我正在尝试勾选“使用条款”。这是我到目前为止所做的:
->add('terms', 'checkbox', array(
'mapped' => false,
'required' => false,
'label' => "J'accepte les Conditions Générales de Vente et les Conditions
Générales d'Utilisation",
'attr' => array('style' => 'margin-left:-257px;'),
'constraints' => new True(array('message' => "SVP acceptez les Conditions
Générales de Vente et
les Conditions Générales
d'Utilisation")),
))
我想制作 label
的“Conditions Générales de Vente”部分作为 PDF 文件的链接供用户阅读。
当用户单击该链接时,Ajax 函数将调用将呈现 PDF 的 Controller 。
我只是不知道如何添加 <a></a>
在label
里面.
最佳答案
这个问题很老,但可能对 future 的访问者有所帮助。我找到了另一种在标签内生成链接的简单方法:
//Set the links as variables
{% set terms %}
<a href="{{ path('terms_conditions') }}">terms &conditions</a>
{% endset %}
{% set policy %}
<a href="{{ path('privacy_policy') }}">privacy policy</a>
{% endset %}
//display the form and use the variables inside the label
{{ form_start(paymentForm) }}
{{ form_widget(paymentForm) }}
<label for="transaction_terms">I have read and accept the {{ terms }} and {{ policy }}.</label>
{{ form_end(paymentForm) }}
关于forms - 将 symfony2 表单标签制作成链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32910479/