Is there a way to add a form field to a link using Form Builder plugin

default discord avatar
christopher.nowlan
2 months ago
4

I am trying to add a form field to link within the emails section

  • discord user avatar
    jacobsfletch
    Payload Team
    2 months ago

    Use the

    formOverrides

    property in your plugin config to add a

    link

    field to your forms. This will allow you to insert links into any of your forms that scroll to the other sections of your form using hash urls. These point to DOM elements on the page with a matching

    id

    attribute. Something like this:



    formBuilder({
      formOverrides: {
        fields: [
          {
            name: 'link',
            type: 'group',
            fields: [
              {
                name: 'label',
                type: 'text',
                required: true,
              },
              {
                name: 'url',
                type: 'text',
                required: true,
              },
            ],
          },
        ],
      },
    })
  • default discord avatar
    christopher.nowlan
    2 months ago

    @jacobsfletch I dont think I quite worded the question correctly I want the email field to be a link



    eg results pdf link url is from a form field

    Screen_Shot_2023-03-14_at_2.48.53_pm.png
  • discord user avatar
    jacobsfletch
    Payload Team
    2 months ago

    Oh I see. Ok that being rich text, you'd probably need to add a custom leaf that can format the link element you see rendered there. Otherwise you could use your own bracket-like syntax and parse it yourself before sending your emails. Something like this

    [Download PDF]({{url}})

    (markdown inspired).

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.