Copied to clipboard

Flag this post as spam?

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


  • Lee 1130 posts 3088 karma points
    Jul 17, 2014 @ 17:12
    Lee
    0

    Html.BeginUmbracoForm doesn't work properly when using UmbracoVirtualNodeByIdRouteHandler

    I have a page which is a virtual one using your UmbracoVirtualNodeByIdRouteHandler to create the routes.

    If I put a standard form on the page using Html.BeginUmbracoForm and post it to any SurfaceController. The Action on the SurfaceController is never triggered, it just reloads the page the form is on?

    Any ideas? I'm so close to a good setup on a package I want to release.

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Jul 18, 2014 @ 01:34
    Shannon Deminick
    0

    Hi Lee,

    Lets say you've created your own custom route to:

    /hello/world

    and you are using UmbracoVirtualNodeByIdRouteHandler.

    The reason you have to use UmbracoVirtualNodeByIdRouteHandler is because Umbraco has no idea what

    /hello/world

    actually is. This is the same exact reason that BeginUmbracoForm doesn't work - because you are operating 'outside' of Umbraco, you are really just using normal MVC. The UmbracoRouteHandler will not be executed (which processes BeginUmbracoForm) because your custom route is executing with your own route handler.

    Since you are using normal MVC, then just use the normal MVC approach to creating forms: Html.BeginForm

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Aug 20, 2015 @ 13:55
    Jeroen Breuer
    0

    Hello,

    I'm using an html action to a surface controller on a page which is also using the UmbracoVirtualNodeByIdRouteHandler. When I try to use the CurrentPage property I get the following exception:

    Cannot find the Umbraco route definition in the route values, the request must be made in the context of an Umbraco request
    

    Is this the same problem?

    Jeroen

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 20, 2015 @ 14:12
    Shannon Deminick
    0

    Please post steps to reproduce, version number, etc...

    IIRC CurrentPage should work, it will be equal to your virtual node that you've assigned the request.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Aug 20, 2015 @ 14:14
    Jeroen Breuer
    0

    Instead of CurrentPage this does work:

    UmbracoContext.Current.PublishedContentRequest.PublishedContent
    

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Aug 20, 2015 @ 14:20
    Jeroen Breuer
    0

    Steps to reproduce:

    1. Create a virtual route with UmbracoVirtualNodeByIdRouteHandler
    2. Do a Html.Action to a surface controller in the view of that virtual route
    3. Try to use CurrentPage in that surface controller

    Umbraco 7.3-beta3

    Jeroen

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 20, 2015 @ 15:10
    Shannon Deminick
    0

    Please log an issue then if you can reproduce it and please include the logic for your child action and your route handler.

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 20, 2015 @ 15:12
    Shannon Deminick
    0

    Here are other issues logged for virtual nodes, be sure that your's is not a duplicate or if there are any work arounds:

    http://issues.umbraco.org/issues/U4?q=UmbracoVirtualNodeRouteHandler

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Aug 20, 2015 @ 20:39
    Dave Woestenborghs
    0

    Hi Jeroen, Shannon

    I just ran some tests on a 7.2.6 site and see the same behavior there. So it's not 7.3 related

    The controller action for the virtual route has the CurrentPage property correctly filled.

    But surface controller actions called from the template don't have it set.

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft