On my page, I have a form which is using Freeform (Solspace).
I'm attempting to setup a custom redirect URL for the form. The form will apply to numerous entries in a channel and some will require different redirect URLs. The main channel in question (Animals) has a relation field which relates it to another channel (Adoption Price). This channel contains a URL field which ideally, I would like the user to be redirected to upon submitting the form. Below is what I have tried so far but with no luck.
//Setting the variable
{% for priceBracket in entry.relatedAdoptionLink %}
{% set priceURL = priceBracket.adoptionPriceLink %}
{% endfor %}
//The Form
{% set form = craft.freeform.form("animalAdoptionForm", {
labelClass: "form-label",
inputClass: "form-control",
instructionsBelowField: true,
overrideValues: {
animalToAdopt: entry.title,
}
}) %}
{{ form.renderTag({returnUrl: "{{priceURL}}"}) }}
Can anybody help me out with this? Setting the variable directly via the entry would be more straight forward but I'm trying to pull the information I need from a relation in another channel.
Thanks