Hi Eric,
Have you made taghelpers availabe by adding
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
to the '_ViewImports.cshtml'? or similar.
Yes. the form <form> and anchor <a> taghelpers and others are auto-colored and autocomplete when typing. They just don't create the action or href when inspecting using devtools in browser.
Eric,
I am not sure if this is it however it seems to recreate the experience you are explaining.
If I set the asp-controller and asp-action to something that doesn't exist in my solution if does not render e.g. this setup does not exist in a default alloy site:
<form asp-controller="Demo" asp-action="Register" method="post">
<!-- Input and Submit elements -->
</form>
Renders
<form method="post" action="">
<!-- Input and Submit elements -->
</form>
Changing to something that does exist I get:
<form asp-controller="StartPage" asp-action="Index">
<!-- Input and Submit elements -->
</form>
Renders
<form action="/modules/App/StartPage" method="post">
<!-- Input and Submit elements -->
</form>
In this blog it does mention that this works based on the application's routing configuration https://www.learnrazorpages.com/razor-pages/tag-helpers/form-tag-helper
That would explain why this didn't work as that route has not been defined in my solution.
Hi Eric
You might miss the ASP.NET MVC conventional route config in your startup if you're going to use standard Asp.Net Mvc route.
When we try to use a tag helper in a episerver view, for example <form asp-controller="MyController" asp-action="MyAction"> never forms a valid action. If we hardcode <form action="/MyController/MyAction" it works. The <form> attrubute works for any of our non-EPiServer controllers/Views.