forked from haacked/aspnet-client-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
haacked#97 Delayed Validation Sample
- Loading branch information
Andrew Korshunov
committed
Aug 9, 2024
1 parent
a986b63
commit a59c47a
Showing
8 changed files
with
67 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@page | ||
@model DemoWeb.Pages.Demos.DelayedValidation | ||
@{ | ||
Layout = "Shared/_Layout"; | ||
} | ||
|
||
<div asp-validation-summary="All"> | ||
<span>Please correct the following errors</span> | ||
</div> | ||
|
||
<fieldset> | ||
<legend>Required Email input with delayed validation.</legend> | ||
<form method="post"> | ||
<div class="form-field"> | ||
<label asp-for="EmailAddress"></label> | ||
<input asp-for="EmailAddress" /> | ||
<span asp-validation-for="EmailAddress"></span> | ||
</div> | ||
<input type="submit" value="Submit"/> | ||
</form> | ||
</fieldset> | ||
|
||
@section Scripts { | ||
<script> | ||
const service = new aspnetValidation.ValidationService(console); | ||
service.bootstrap({ delayedValidation: true }); | ||
</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,14 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using Microsoft.AspNetCore.Mvc.Rendering; | ||
|
||
namespace DemoWeb.Pages.Demos; | ||
|
||
public class DelayedValidation : PageModel | ||
{ | ||
[BindProperty] | ||
[Required] | ||
[EmailAddress] | ||
public string? EmailAddress { get; set; } | ||
} |
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.
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