Razor.Templating.Core icon indicating copy to clipboard operation
Razor.Templating.Core copied to clipboard

Form action method not forming

Open dev-vkagrawal opened this issue 3 years ago • 13 comments
trafficstars

When we use regular <form> attribute with asp-controller and asp-action html tag helpers then final output does not contain action property of form, instead it contains blank action value on specified <form> like <form action="" method="post">... </form> Any solution please?

dev-vkagrawal avatar Jan 02 '22 19:01 dev-vkagrawal

Hi @dev-vkagrawal, are you rendering the .cshtml file from console app or mvc?

soundaranbu avatar Jan 03 '22 03:01 soundaranbu

Hi @soundaranbu it is from mvc application. From controllers' action method I want to return view's string content along with some other couple of data. Everything seems returning properly except the form action value when used with asp-controller and asp-action.

dev-vkagrawal avatar Jan 03 '22 18:01 dev-vkagrawal

Ok I'll look into it this weekend. Between what version of dotnet and the library are you using?

soundaranbu avatar Jan 06 '22 04:01 soundaranbu

I am using .Net Core 3.1 and nuget package version of library is 1.6.0

dev-vkagrawal avatar Jan 07 '22 17:01 dev-vkagrawal

Thanks @soundaranbu can you please tell me which version of nuget package with a fix would be compatible with .Net core 3.1 ?

dev-vkagrawal avatar Jan 10 '22 17:01 dev-vkagrawal

Hi @dev-vkagrawal , Currently the fix is in testing phase. I'll release a preview version in one or two days. I'll let you know by then. Thanks

soundaranbu avatar Jan 10 '22 18:01 soundaranbu

Hi @dev-vkagrawal, I've made a pre-release v1.6.1-rc.1. please it try out and let me know https://www.nuget.org/packages/Razor.Templating.Core/1.6.1-rc.1

Thanks.

soundaranbu avatar Jan 13 '22 02:01 soundaranbu

Hi @soundaranbu it does not seem working with either version. Still action property of < form > is blank.

dev-vkagrawal avatar Jan 25 '22 16:01 dev-vkagrawal

Ok that's weird. if possible, please send a sample project to reproduce the issue. otherwise, it'll be hard to look into this further. thanks!

soundaranbu avatar Jan 25 '22 16:01 soundaranbu

It is simple .net core mvc project and I have regular view with form element and action property on it. When trying to get html of such view then just action property is blank in resultant view string.

dev-vkagrawal avatar Jan 29 '22 17:01 dev-vkagrawal

Ok then you might need to take a look at this sample mvc project which renders the form action method properly and let me know how it works for you.

Checkout branch: release/1.6.x https://github.com/soundaranbu/RazorTemplating/tree/release/1.6.x/examples/Mvc/ExampleWebApp.NetCore3_1

Look for this action method: https://github.com/soundaranbu/RazorTemplating/blob/1ff2c21c0ee4b9bd218f4b6f0cca93898dee6264/examples/Mvc/ExampleWebApp.NetCore3_1/Controllers/HomeController.cs#L66-L70

Output Url: /Home/TagHelpers

Template: image

Output: image

soundaranbu avatar Jan 31 '22 02:01 soundaranbu

Hi, I cloned project but solution explorer shows just .Net 6 project, while I am trying to see .Net Core 3.1 project to test. Can you please tell me what else I need to change to make it work with .net core 3.1? Please see attached image. image

dev-vkagrawal avatar Feb 08 '22 17:02 dev-vkagrawal

Hi @dev-vkagrawal, it looks like you are in master branch. Please checkout release/1.6.x branch where you can find the project.

soundaranbu avatar Feb 09 '22 06:02 soundaranbu

Closing this one as I have shown the output with screenshots https://github.com/soundaranbu/Razor.Templating.Core/issues/35#issuecomment-1025310067

In case, if you still have issues, feel free to reopen. Thanks :)

soundaranbu avatar Sep 19 '22 06:09 soundaranbu