How can i add anchor link in form label?

I’m trying to add this way:

    - name: agree_to_terms
      label: Li e aceito o [termo](http://filelink.com) de prestação de serviços educacionais.
      type: checkbox
      validate:
        required: true

but it does not work :confused:

Try html, not markdown

    - name: agree_to_terms
       label: Li e aceito o <a href="http://filelink.com">termo</a> de prestação de serviços educacionais.
       type: checkbox
       validate:
         required: true

Hi, I’m trying to achieve the same thing but the HTML is not processed… Is there anything else I’m missing?

I guess you have to add ’ ’ since then it will be converted to a string.

    - name: agree_to_terms
   label: 'Li e aceito o <a href="http://filelink.com">termo</a> de prestação de serviços educacionais.'
   type: checkbox
   validate:
     required: true

Thanks for your reply. Yes, I’ve done that, still no luck…

Very strange… It works for me. How does the output look? And can you show me the TWIG code that outputs this?

I’m sure I’m missing something. I copy-pasted

- name: agree_to_terms
   label: 'Li e aceito o <a href="http://filelink.com">termo</a> de prestação de serviços educacionais.'
   type: checkbox
   validate:
     required: true

after fields

but all it displays is a checkbox and Li e aceito o <a href="http://filelink.com">termo</a> de prestação de serviços educacionais. (i.e. no link)

I haven’t used any TWIG - should I?

Maybe you need to overwrite user/plugins/form/templates/forms/fields/checkbox/checkbox.html.twig in your child theme. There is an escaping for the field labels.

I think I know why. When you use label it is in a html tag that can not process html. If you can copy the html source of the form so I can see what tags the form is using then I can find it in the form plugin and make a work around for you.

1 Like

Maybe changing {{ field.label|t|e }} to {{ field.label|t }} helps.

1 Like

Oh yeah, this sorted it!!! Thanks for both of your input.

Nice, it worked out! And yeah e option disable HTML processing.

Please mark @chris_jung replay as an answer :slight_smile:

I’m not sure I can mark it as an answer because it wasn’t me who started the topic…

You are right…

Then @lrnzt please mark @chris_jung reply as an answer :slight_smile:

You can easily add an anchor link in the form of a label which is very easy like adding a hyperlink. You may sometimes face gmail server error 007 which can be easily fixed.