Copied to clipboard

Flag this post as spam?

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


  • Morten Christensen 61 posts 215 karma points
    Aug 19, 2014 @ 16:43
    Morten Christensen
    0

    Create post form in backend

    Hi

    When we use razor to create a new form, we will use @using(Html.BeginUmbracoForm("CreateComment")) to create the whole form tag, and Umbraco will then add a hidden field with an Id to the form. In our SurfaceController class, we can then catch the post form. All good!

    BUT

    I want to create this form tag from my C# code, or even beter, create a custom mvc route and then create my own form tag, with my own action="controller/something". Or is it possible to create that custom Id umbraco renders when we use BeginUmbracoForm?


    I tried to add something like

    var p = new Umbraco.Web.Mvc.UmbracoViewPage(); p.Html.BeginUmbracoForm.....

    But its not possible...

    So do someone know how to create a form post tag from backend?

     

    And then you may ask "why on earth would I do that?"... Well, I render the whole frontend in EJS, so I need to create my own form tags.

     

    Thanks!

  • Morten Christensen 61 posts 215 karma points
    Aug 22, 2014 @ 10:57
    Morten Christensen
    100

    I was able to create a custom route, that points to my own surfacecontroller. I had tried this first, but I pointed it to a RenderMvc controller and not a Surface controller.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies