JonDJones.Umbraco.V9.StarterKit
JonDJones.Umbraco.V9.StarterKit copied to clipboard
Form input
Hi,
Thanks for the vid. Having a hard time getting the search to work. How do you fire a form at the search controller? Can't find how it actually starts off in the repo. The rest is fine, just can't hit the controller. As you said if you called the controller the same name as the search page it should just route. Using the code below, the Search action is never hit. Umbraco interferes with the usual ActionLink usage so we end up calling the Index action. Changing the Search action to Index results (for me at least) in a duplicate reference error and oblivion....
<form action="/search" method="get">
<fieldset>
<input id="search" name="searchTerm" type="text" placeholder="Search..."><input type="submit" value="Go" class="searchbutton">
</fieldset>
</form>
As you suggested, tried adding the following to Startup.cs to no avail:
u.EndpointRouteBuilder.MapControllerRoute(
"search-route",
"/search/{action}/{id?}",
new { Controller = "Search", Action = "Search" });
Any thoughts would be appreciated.
TIA