Browse Source

Added ABP Form Tag Helpers section

pull/5690/head
Halil İbrahim Kalkan 5 years ago
parent
commit
cacf4bc351
  1. 51
      docs/en/UI/AspNetCore/Forms-Validation.md
  2. 8
      docs/en/UI/AspNetCore/Tag-Helpers/Dynamic-Forms.md
  3. BIN
      docs/en/images/abp-dynamic-form-result.png

51
docs/en/UI/AspNetCore/Forms-Validation.md

@ -74,9 +74,58 @@ namespace MyProject.Web.Pages
}
````
## ABP Form Tag Helpers
In order to create the form in a razor page, create a property in your `PageModel` class:
```csharp
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace MyProject.Web.Pages
{
public class CreateMovieModel : PageModel
{
[BindProperty]
public MovieViewModel Movie { get; set; }
public void OnGet()
{
Movie = new MovieViewModel();
}
public async Task OnPostAsync()
{
if (ModelState.IsValid)
{
//TODO: Save the Movie
}
}
}
}
```
Then you can render the form in the `.cshtml` file:
```html
@page
@model MyProject.Web.Pages.CreateMovieModel
<h2>Create a new Movie</h2>
<abp-dynamic-form abp-model="Movie" submit-button="true" />
```
The result is shown below:
![abp-dynamic-form-result](../../images/abp-dynamic-form-result.png)
See the *Localization & Validation* section below to localize the field display names and see how the validation works.
> See [its own document](Tag-Helpers/Dynamic-Forms.md) for all options of the `abp-dynamic-form` tag helper.
## ABP Form Tag Helpers
## Localization & Validation
## See Also

8
docs/en/UI/AspNetCore/Tag-Helpers/Dynamic-Forms.md

@ -1,7 +1,5 @@
# Dynamic Forms
`Warning:` Before getting into this document, be sure that you have clearly understood [abp form elements](Form-elements.md) document.
## Introduction
`abp-dynamic-form` creates a bootstrap form for a given c# model.
@ -272,4 +270,8 @@ You can set it yourself by using `[Display()]` attribute of Asp.Net Core. You ca
````csharp
[Display(Name = "Name")]
public string Name { get; set; }
````
````
## See Also
* [Form Elements](Form-elements.md)

BIN
docs/en/images/abp-dynamic-form-result.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Loading…
Cancel
Save