-
Notifications
You must be signed in to change notification settings - Fork 25
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 #119 from andkorsh/main
#97 Implemented delayed validation by introducing delayedValidation o…
- Loading branch information
Showing
7 changed files
with
96 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@page | ||
@model DemoWeb.Pages.Demos.ImmediateValidation | ||
@{ | ||
Layout = "Shared/_Layout"; | ||
} | ||
|
||
<div asp-validation-summary="All"> | ||
<span>Please correct the following errors</span> | ||
</div> | ||
|
||
<fieldset> | ||
<legend>Required Email input with data-val-event specified for immediate validation as you type.</legend> | ||
<form method="post"> | ||
<legend>Input with immediate validation (<code>data-val-event="input"</code>)</legend> | ||
<div class="form-field"> | ||
<label asp-for="EmailAddress"></label> | ||
<input asp-for="EmailAddress" data-val-event="input" /> | ||
<span asp-validation-for="EmailAddress"></span> | ||
</div> | ||
<legend>Input with default behavior</legend> | ||
<div class="form-field"> | ||
<label asp-for="AnotherEmailAddress"></label> | ||
<input asp-for="AnotherEmailAddress" /> | ||
<span asp-validation-for="AnotherEmailAddress"></span> | ||
</div> | ||
<input type="submit" value="Submit"/> | ||
</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,18 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace DemoWeb.Pages.Demos; | ||
|
||
public class ImmediateValidation : PageModel | ||
{ | ||
[BindProperty] | ||
[Required] | ||
[EmailAddress] | ||
public string? EmailAddress { get; set; } | ||
|
||
[BindProperty] | ||
[Required] | ||
[EmailAddress] | ||
public string? AnotherEmailAddress { 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