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.
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.
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
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!
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.
is working on a reply...