diff --git a/Controllers/Validations.cs b/Controllers/Validations.cs
index 188d29b..28d793e 100644
--- a/Controllers/Validations.cs
+++ b/Controllers/Validations.cs
@@ -10,6 +10,12 @@ public IActionResult CheckRemote(string id)
return Ok(id == "42");
}
+ [HttpPost]
+ public IActionResult CheckboxRemote(bool isChecked)
+ {
+ return Ok(isChecked);
+ }
+
[HttpGet]
public IActionResult Test()
{
diff --git a/Pages/Demos/Checkboxes.cshtml b/Pages/Demos/Checkboxes.cshtml
index 3a0a640..e366c99 100644
--- a/Pages/Demos/Checkboxes.cshtml
+++ b/Pages/Demos/Checkboxes.cshtml
@@ -52,8 +52,8 @@
}
- @if (Model.SelectedAnimals.Any()) {
- Selected animals: @string.Join(", ", Model.SelectedAnimals)
+ @if (Model.SelectedAnimals!.Any()) {
+ Selected animals: @string.Join(", ", Model.SelectedAnimals!)
}
diff --git a/Pages/Demos/Checkboxes.cshtml.cs b/Pages/Demos/Checkboxes.cshtml.cs
index 7e455fc..7501d91 100644
--- a/Pages/Demos/Checkboxes.cshtml.cs
+++ b/Pages/Demos/Checkboxes.cshtml.cs
@@ -41,6 +41,7 @@ public IActionResult OnPost()
public class InputModel
{
+ [Remote("CheckboxRemote", "Validations", HttpMethod = "Post")]
public bool IsChecked { get; set; }
}
@@ -50,6 +51,7 @@ public class InputModel
public class Selectable
{
public required string Name { get; set; }
+
public bool IsSelected { get; set; }
}
}
\ No newline at end of file