Redirect back to page after an embedded survey is submitted, instead of displaying confirmation page

Options

Greetings all,

I've been asked if we can have the submission of a Survey, which is embedded on an LO page, redirect back to the same page and display a confirmation message above the survey questions. This action would replace the redirection to the Confirmation page listed in the Survey settings. I think this could be done easily enough with a bit of scripting and tags, but wanted to see if someone had already ‘built the wheel’, so to speak. Thanks in advance!

Tagged:

Comments

  • I've made a few pages similar to this. The survey is embedded on a pagebuilder page, and the confirmation page (in the survey settings) is the same pagebuilder page, but I'll add something like “&survey=completed” or whatever to the end of the url.

    Then I'll have 2 sections on the pagebuilder page - 1 section has the survey and the other has the confirmation text. Hide the confirmation section by default and then use javascript to check the url. If the “survey=completed” is present in the url, hide the survey section and display the confirmation section instead.

  • Thanks for the info, Daryl. One additional aspect of this that I really should have mentioned is that the Survey will be embedded on several LO pages, so we can't realistically set the confirmation page to be the same pagebuilder.

    We're currently grabbing the pagebuilder name in the URL via an S8 tag. I've got another resource working on a script to redirect the browser back to this page, with the proper message from the confirmation page.

    Thanks again!

  • @Erik Domingo U5 can add <META> headers to your page, which can do redirects. Just be sure to include a conditional that keeps it from triggering when you're viewing the page in admin.

    It might work to make all of your surveys redirect to a generic pagebuilder page like yoursite.org/site/SPageNavigator/survey_redirector?keyword=______ and then that page has something like…

    [[?x3301x::x[[S4]]x::--CLICK HERE TO EDIT --::

    [[?xx::x[[S334:keyword]]x::

    all-else-fails fallback content here

    ::

    [[?xsurvey1x::x[[S334:keyword]]x::
    [[U5:metatags=<meta http-equiv="refresh" content="0;URL='____________________'">]]
    ::]]

    [[?xsurvey2x::x[[S334:keyword]]x::
    [[U5:metatags=<meta http-equiv="refresh" content="0;URL='____________________'">]]
    ::]]

    ]]

    ]]

    In theory you only really need U5 to redirect it, that'll throw a meta refresh in the header. No law that says you can't also put in a JS redirect in there alongside the U5, like Daryl suggests. It'd be something like:

    <script type="text/javascript">
    window.location.href='____________________'
    </script>

    @Daryl Bunker note that S334 tag, it might be a better way to do things than using Javascript to load alternate content. In your case it'd be something like:

    [[?xcompletedx::x[[S334:survey]]x::

    thank you content

    ::

    content including embedded survey

    ]]

    …or you could use that technique to load the survey directly instead of embedding it elsewhere. You'd add a caption that has the conditional displaying a style tag that hides/unhides the survey form instead.

Categories