-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from haacked/haacked/117-submit-value-propaga…
…tion-fix Submit value propagation fix
- Loading branch information
Showing
10 changed files
with
73 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@page | ||
@model DemoWeb.Pages.Demos.SubmitButtonDownload | ||
|
||
@{ | ||
Layout = "Shared/_Layout"; | ||
} | ||
|
||
<fieldset> | ||
<legend>Required ASP.NET Checkboxes with hidden input</legend> | ||
|
||
@DateTime.UtcNow | ||
|
||
<form method="post"> | ||
<div class="form-field"> | ||
<p> | ||
This simple test demonstrates that we ensure that submit button values are submitted | ||
correctly even when the form is posting to a download (and the page is not refreshed). | ||
</p> | ||
|
||
Required: <input asp-for="SomeRequiredValue" /> | ||
|
||
<input type="submit" asp-for="SubmitButtonValue" value="PDF" /> | ||
<input type="submit" asp-for="SubmitButtonValue" value="Excel" /> | ||
</div> | ||
</form> | ||
</fieldset> | ||
|
||
@section Scripts { | ||
<script> | ||
const service = new aspnetValidation.ValidationService(console); | ||
service.bootstrap(); | ||
</script> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace DemoWeb.Pages.Demos; | ||
|
||
public class SubmitButtonDownload : PageModel | ||
{ | ||
[BindProperty] | ||
[Required] | ||
public string? SubmitButtonValue { get; set; } | ||
|
||
[BindProperty] | ||
[Required] | ||
public string? SomeRequiredValue { get; set; } | ||
|
||
public IActionResult OnPost() | ||
{ | ||
return File([0], "application/octet-stream", $"DEMO-{SubmitButtonValue}.txt"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters