Copied to clipboard

Flag this post as spam?

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


  • Dee 4 posts 54 karma points
    Mar 19, 2015 @ 17:56
    Dee
    0

    Contour Send to Path - Using XPath always assigns Content Node

    Hi

    (Umbraco 7.2.2 Contour 3.0.24)

    I would like my form to go to a sibling(identified by the document type alias) of the page that it is rendered on. I am trying to use the XPath functionality as this should be the ideal solution. However when I try to set my XPath here it always assigns the Root content node as the Page aka node id -1. If I run the form it will stay on the form's page and display the thank you message text. 

    I have tried the XPath example/solutions in this post https://our.umbraco.org/forum/umbraco-pro/contour/17172-Submiting-the-form-XPATH-example with no luck.

    My Node Sturcture:

    Parent

    -- Sub Page

    -------- Form Page

    -------- Thank You Page

    --- Sub Page 2

    -------- Form Page

    -------- Thank You Page

    Thanks in advance

  • bob baty-barr 1180 posts 1294 karma points MVP
    Mar 25, 2015 @ 18:00
    bob baty-barr
    0

    did you ever get a solution to this? i am struggling with similar.

  • Dee 4 posts 54 karma points
    Mar 25, 2015 @ 18:13
    Dee
    0

    Nope, not yet. I ended up creating a node that redirects you to the correct page and setting that node as the one that the form goes to. So I am basically getting the page it was submitting on from the record entry and then finding the sibling node of that page that is the document type that I want.

  • bob baty-barr 1180 posts 1294 karma points MVP
    Mar 25, 2015 @ 18:35
    bob baty-barr
    0

    ooh, nice work around... i posted our issue to twitter... we will see if anyone saves us...

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Mar 25, 2015 @ 20:41
    Chriztian Steinmeier
    100

    Hi Dee & Bob,

    If I understand Tim correctly from his answer to the page you mention, the XPath should end up selecting the id of the page to show.

    In your case you should be able to use something like this:

    $currentPage/../DOCTYPE_ALIAS/@id
    

    Assuming $currentPage is the Form page, and there's only one node of the DOCTYPE_ALIAS kind as a sibling of the Form page (?)

    Let me know if it works,

    /Chriztian

  • bob baty-barr 1180 posts 1294 karma points MVP
    Mar 25, 2015 @ 22:09
    bob baty-barr
    0

    i am trying to get the child page of type with...

    $currentPage/BasicPage/@id

    but.. i am getting the following error...

    Error loading MacroEngine script (file: MvcRenderContourForm.cshtml, Type: ''. Exception: System.FormatException: Input string was not in a correct format.
       at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
       at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
       at CallSite.Target(Closure , CallSite , Type , Object )
       at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
       at Umbraco.Forms.Mvc.Controllers.FormRenderController.ContourForm(FormViewModel model, Boolean captchaIsValid) in f:\TeamCity\buildAgent\work\fd622d7f786e1305\Umbraco.Forms.Mvc\Controllers\FormRenderController.cs:line 235
       at lambda_method(Closure , ControllerBase , Object[] )
       at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.b__10()
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
       at System.Web.Mvc.Controller.ExecuteCore()
       at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
       at Umbraco.Forms.Mvc.Bridge.Html.MvcBridgeExtensions.RenderMvcAction(HtmlHelper helper, String action, String controller, String formId, String antiForgeryToken, Object node, Object parameter) in f:\TeamCity\buildAgent\work\fd622d7f786e1305\Umbraco.Forms.Mvc\Bridge\Html\MvcBridgeExtensions.cs:line 84
       at ASP._Page_macroScripts_MvcRenderContourForm_cshtml.Execute() in c:\inetpub\wwwroot\clients\umbraco.segalco.com\MacroScripts\MvcRenderContourForm.cshtml:line 9
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.WebPages.WebPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
       at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
       at umbraco.macro.loadMacroScript(MacroModel macro)
       at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)

    any thoughts on that??

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Mar 25, 2015 @ 22:18
    Chriztian Steinmeier
    0

    Hey Bob,

    Sounds a lot like it's getting an empty string instead of an Id - probable causes:

    1. BasicPage is not really the alias
    2. There are more than one BasicPage pages as the Form page's siblings
    3. The BasicPage is not published

    (To fix #2 you'd put a predicate on, to select the first, e.g.: $currentPage/../BasicPage[1]/@id)

    Keep at it—I haven't used it myself yet, so poking a little in the blind still :-)

    /Chriztian

  • bob baty-barr 1180 posts 1294 karma points MVP
    Mar 25, 2015 @ 22:25
    bob baty-barr
    0

    yeah, i am an idiot... it works... 

    $currentPage/BasicPage[1]/@id

    I added the [1] just to be safe... of course, i have a multi-site impementation and was testing in the wrong site... eef.

Please Sign in or register to post replies

Write your reply to:

Draft