diff --git a/Pages/Demos/SubmitButton.cshtml b/Pages/Demos/SubmitButton.cshtml index ce4956e..dbcad71 100644 --- a/Pages/Demos/SubmitButton.cshtml +++ b/Pages/Demos/SubmitButton.cshtml @@ -11,7 +11,7 @@

- This simple test demonstrates that we ensure that submit buttons. + This simple test demonstrates that we ensure that submit button values are submitted.

diff --git a/Pages/Demos/SubmitButtonDownload.cshtml b/Pages/Demos/SubmitButtonDownload.cshtml new file mode 100644 index 0000000..cca4113 --- /dev/null +++ b/Pages/Demos/SubmitButtonDownload.cshtml @@ -0,0 +1,33 @@ +@page +@model DemoWeb.Pages.Demos.SubmitButtonDownload + +@{ + Layout = "Shared/_Layout"; +} + +
+ Required ASP.NET Checkboxes with hidden input + + @DateTime.UtcNow + + +
+

+ 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). +

+ + Required: + + + +
+ +
+ +@section Scripts { + +} \ No newline at end of file diff --git a/Pages/Demos/SubmitButtonDownload.cshtml.cs b/Pages/Demos/SubmitButtonDownload.cshtml.cs new file mode 100644 index 0000000..b7c96b9 --- /dev/null +++ b/Pages/Demos/SubmitButtonDownload.cshtml.cs @@ -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"); + } +} \ No newline at end of file diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml index 22e13b3..c2cf5b7 100644 --- a/Pages/Index.cshtml +++ b/Pages/Index.cshtml @@ -8,6 +8,7 @@