3

I'd like my form to return to the same page with a param ?success.

The page slug is dynamic though so will change depending on what form you are on.

/dynamic-url?success

{% set entrySlug = craft.request.lastSegment %}                         


                                    {{ craft.freeform.form("landingPage", {
                                        id: "form-landing",
                                        useRequiredAttribute: true,
                                        returnUrl: "{{ entrySlug }}?success"
                                    }).render() }}

Obviously if i just use returnUrl: "?success" it takes me back to the homepage.

The idea of this is so I can trigger facebook events upon form completion, so open to any better approaches.

Thanks

3

Have you tried using the {{ craft.request.url }} variable in your returnUrl setting?

Also you should be able to format it like so:

returnUrl: craft.request.url ~ "?success"

More details about the craft.request model can be found here: https://craftcms.com/docs/templating/craft.request

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.