diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml index 1d5f0ed..d1e5f50 100644 --- a/Pages/Index.cshtml +++ b/Pages/Index.cshtml @@ -9,7 +9,31 @@ -

@Model.StatusMessage

+@if (Model.StatusMessage != null) +{ +

@Model.StatusMessage

+ +

Submitted Values

+ + + + + + + + + + + + + + + + + + +
Id: @Model.Id
Control: @Model.Control
Selected Animals: @(Model.SelectedAnimals != null ? string.Join(", ", Model.SelectedAnimals) : null)
Selected Color: @Model.SelectedColor
+}
Form 1 @@ -27,14 +51,35 @@
- - - - + @foreach (var animal in Model.Animals) + { + checked } /> + + } + +
+ +
+ @foreach (var color in Model.Colors) + { + checked } /> + + } +
@@ -102,6 +147,27 @@ diff --git a/Pages/Index.cshtml.cs b/Pages/Index.cshtml.cs index 70ae3e4..fd99930 100644 --- a/Pages/Index.cshtml.cs +++ b/Pages/Index.cshtml.cs @@ -21,7 +21,15 @@ public class IndexModel : PageModel [BindProperty] [Required] - public string? Color { get; set; } + public List? SelectedAnimals { get; set; } + + public string[] Animals = new[] { "Dog", "Cat", "Fish" }; + + [BindProperty] + [Required] + public string? SelectedColor { get; set; } + + public string[] Colors = new[] { "Red", "Green", "Blue" }; public IActionResult OnPost() { diff --git a/wwwroot/css/site.css b/wwwroot/css/site.css index 609a332..67c3d10 100644 --- a/wwwroot/css/site.css +++ b/wwwroot/css/site.css @@ -31,3 +31,19 @@ body { font-size: 2em; font-weight: bold; } + +.input-validation-error + label { + color: red; +} + +.input-validation-valid + label { + color: green; +} + +table.form-data { + margin-bottom: 10px; +} + +table.form-data th { + text-align: left; +} \ No newline at end of file