-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
✔️ Resolution: By DesignResolved because the behavior in this issue is the intended design.Resolved because the behavior in this issue is the intended design.area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templates
Milestone
Description
The working example below
<form asp-action="DeleteConfirmed">
<input type="submit" value="Delete" />
</form>
public async Task<IActionResult> Delete(int id)
{
// intentionally removed for simplicity
}
[HttpPost]
public async Task<IActionResult> DeleteConfirmed(int id)
{
// intentionally removed for simplicity
}
no longer works if I add asp-route-id="1"
as follows.
<form asp-action="DeleteConfirmed">
<input type="submit" asp-route-id="1" value="Delete" />
</form>
public async Task<IActionResult> Delete(int id)
{
// intentionally removed for simplicity
}
[HttpPost]
public async Task<IActionResult> DeleteConfirmed(int id)
{
// intentionally removed for simplicity
}
To make it work again, I have to explicitly specify asp-action=DeleteConfirmed
in the submit button as follows
<form asp-action="AnyTrivialString">
<input type="submit" asp-route-id="1" value="Delete" asp-action="DeleteConfirmed" />
</form>
Note: A string assigned to asp-action
of the form will be overridden by the submit button. As a result, the form asp-action
becomes trivial.
Question
Is it a bug or a known feature?
Minimal Working Example
Metadata
Metadata
Assignees
Labels
✔️ Resolution: By DesignResolved because the behavior in this issue is the intended design.Resolved because the behavior in this issue is the intended design.area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templates