Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Jul 26, 2017 @ 15:19
    Nik
    0

    Form submission, Goto Page A or Page B subject to answer

    Hi All,

    I am struggling to use Umbraco Forms, despite the fact the basic concept of a form is easy. I'm hoping someone here can shed some light on what I might be doing wrong, or missing in my understanding.

    Out of the box, Umbraco Forms allows you to select a page to redirect to upon a successful submission.

    What I would like to achieve is redirect to Page A if a checkbox is set, however if the checkbox isn't set redirect to Page B.

    I have a feeling I need to use a Custom Workflow but I am feeling exceptionally stuck with how to go about implementing this.

    Has anyone tried to do this in the past and can give me some pointers that would be great.

    Thanks,

    Nik

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Jul 26, 2017 @ 15:27
    Nicholas Westby
    1

    Depending on which version of Umbraco Forms or Contour you are using, there should be a file at ~/umbraco/plugins/umbracoContour/views/form.cshtml that has this line:

    @if (Model.SubmitHandled)
    

    Inside of that if statement, you can handle the redirect. I think you can inspect field values in this file (you'll want to double check that to be sure). Assuming you can just hardcode the redirects, you should be all set.

    Also, if this should not apply to all forms on your website, you can differentiate this file to be specific to a particular form by copying and putting it in a particular subfolder (again, the particular folder path may depend on the Umbraco Forms version, but it's basically be a folder named based on the GUID for the form you want to differentiate).

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Jul 26, 2017 @ 21:19
    Nik
    0

    Oh thanks Nicholas, that could be a way to go about it. What I was hoping for was a way to pick the two pages in the back office when configuring the form though (at least that is the ideal anyways).

    fyi, using the latest Umbraco Forms as it's an Umbraco Cloud project :-)

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Jul 26, 2017 @ 22:30
    Nicholas Westby
    0

    What I was hoping for was a way to pick the two pages in the back office when configuring the form though (at least that is the ideal anyways).

    I can think of a really weird way of doing that (in short, create a custom field type that isn't rendered on the page but that allows you to pick the pages).

    Another idea would be to have a couple of picker properties on a content node (perhaps the same node as the page that is rendering the form) and you can fetch the pages to redirect to from those properties.

Please Sign in or register to post replies

Write your reply to:

Draft