Skip to content

Commit

Permalink
From now you can add formhelper scripts to the head or body tag. Samp…
Browse files Browse the repository at this point in the history
…le project updated to net core 3.1.
  • Loading branch information
sinanbozkus committed Sep 18, 2020
1 parent a7b24b0 commit 1cbe657
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
4 changes: 2 additions & 2 deletions sample/FormHelper.Samples/FormHelper.Samples.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -20,7 +20,7 @@


<ItemGroup>
<PackageReference Include="FluentValidation.AspNetCore" Version="8.5.0-preview5" />
<PackageReference Include="FluentValidation.AspNetCore" Version="9.2.0" />
</ItemGroup>

</Project>
12 changes: 6 additions & 6 deletions sample/FormHelper.Samples/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public Startup(IConfiguration configuration)

public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews()
.AddFluentValidation();

// You can add these validators in a separate class.
services.AddTransient<IValidator<ProductFormViewModel>, ProductFormViewModelValidator>();

// Add FormHelper to the project.
services.AddFormHelper();

Expand All @@ -31,12 +37,6 @@ public void ConfigureServices(IServiceCollection services)
// RedirectDelay = 30,
// ToastrDefaultPosition = ToastrPosition.BottomFullWidth
//});

// You can add these validators in a separate class.
services.AddTransient<IValidator<ProductFormViewModel>, ProductFormViewModelValidator>();

services.AddControllersWithViews()
.AddFluentValidation();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
Expand Down
17 changes: 9 additions & 8 deletions sample/FormHelper.Samples/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@
<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>


<!-- form helper -->
<link rel="stylesheet" href="/formhelper/formhelper.min.css" />
<script src="/formhelper/formhelper.bundle.min.js"></script>
<!-- remote modal -->
<script src="//cdn.jsdelivr.net/gh/sinanbozkus/remotemodal/remotemodal.js"></script>


</head>
<body>

<div class="text-center mt-3">
<h1 class="display-4"><img src="~/formhelper-logo.png" class="mb-2 mr-3" />Form Helper</h1>
<h1 class="display-4"><img src="~/formhelper-logo.png" class="mb-2 mr-3" />Form Helper</h1>
<p>Form & Validation Helper for <a href="https://dotnet.microsoft.com/learn/web/aspnet-hello-world-tutorial/intro" target="_blank">ASP.NET Core</a></p>
</div>

Expand Down Expand Up @@ -67,6 +62,12 @@

<script src="~/js/site.js" asp-append-version="true"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>
<script src="/formhelper/formhelper.bundle.min.js"></script>
<!-- remote modal -->
<script src="//cdn.jsdelivr.net/gh/sinanbozkus/remotemodal/remotemodal.js"></script>

<script>
$("#openModal").click(function () {
RemoteModal("@Url.Action("Modal", "Home")");
Expand Down
7 changes: 5 additions & 2 deletions src/FormHelper/FormHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<PropertyGroup>
<PackageId>FormHelper</PackageId>
<Version>3.2.1</Version>
<Version>3.2.3</Version>
<Authors>Sinan BOZKUS</Authors>
<projectUrl>https://github.com/sinanbozkus/FormHelper</projectUrl>
<RepositoryUrl>https://github.com/sinanbozkus/FormHelper</RepositoryUrl>
<description>Form and Validation Helper for ASP.NET Core (Compatible with Fluent Validation)</description>
<description>Transform server-side validations to client-side without writing any javascript code. (Compatible with Fluent Validation)</description>
<Copyright>Copyright (c) Sinan Bozkus 2020</Copyright>
<tags>fluentvalidation fluent validation form helper validation helper notification crud</tags>
<PackageIconUrl>http://www.sinanbozkus.com/nuget/formhelper/formhelper-logo.png</PackageIconUrl>
Expand All @@ -19,8 +19,11 @@
</PropertyGroup>

<ItemGroup>
<None Remove="Styles\formhelper.css" />
<None Remove="Styles\formhelper.min.css" />
<None Remove="Scripts\formhelper.js" />
<None Remove="Scripts\formhelper.min.js" />
<None Remove="Scripts\formhelper.bundle.min.js" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/FormHelper/TagHelpers/FormTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public async override Task ProcessAsync(TagHelperContext context, TagHelperOutpu
output.Attributes.Add("enableButtonAfterSuccess", EnableButtonAfterSuccess);
output.Attributes.Add("resetFormAfterSuccess", ResetFormAfterSuccess);
output.Attributes.Add("checkTheFormFieldsMessage", configuration.CheckTheFormFieldsMessage);
output.PostElement.AppendHtml($"<script>$(document).ready(function () {{$('#{formId}').UseFormHelper();}});</script>");
output.PostElement.AppendHtml($"<script>window.addEventListener('load',function () {{$('#{formId}').UseFormHelper();}});</script>");

if (usedFormHelperTag)
{
Expand Down

0 comments on commit 1cbe657

Please sign in to comment.