Skip to content

Method of submit value propagation makes certain workflows impossible #117

Closed
@lukearnould

Description

@lukearnould

Consider a form like the following that POSTs to an endpoint that returns a FileContentResult:

<form asp-action="Download" asp-controller="Home">
    <button type="submit" name="format" value="PDF">Download PDF</button>
    <button type="submit" name="format" value="Excel">Download Excel</button>
</form>

When using this form with aspnet-client-validation, a hidden input gets created upon submit button click in order to POST the button's value. It seems this behavior was introduced here in order to work around limitations of .submit() in JavaScript: #52

The issue with this is that the hidden input does not get cleaned up after instantiation, and the page does not reload in this instance due to the nature of a FileContentResult endpoint. This causes conflicts when clicking a different submit button later as the hidden input will override its value due to possessing the same name attribute value ("format").

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions