27. Using the Forms Tag Helpers Flashcards

1
Q

What are Form Tag Helpers?

A

These built-in tag helpers transform HTML form elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why are Form Tag Helpers useful?

A

These tag helpers ensure that HTML forms reflect the application’s routing configuration and data model.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How are Form Tag Helpers used?

A

Tag helpers are applied to HTML elements using asp-* attributes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Are there any pitfalls or limitations to Form Tag Helpers?

A

These tag helpers are reliable and predictable and present no serious issues.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Are there any alternatives to Form Tag Helpers?

A

You don’t have to use tag helpers and can define forms without them if you prefer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain the form handling pattern?

A

Most HTML forms exist within a well-defined pattern, shown in Figure 27-2. First, the browser sends an HTTP GET request, which results in an HTML response containing a form, making it possible for the user to provide the application with data. The user clicks a button that submits the form data with an HTTP POST request, which allows the application to receive and process the user’s data. Once the data has been processed, a response is sent that redirects the browser to a URL that provides confirmation of the user’s actions.
This is known as the Post/Redirect/Get pattern, and the redirection is important because it means the user can click the browser’s reload button without sending another POST request, which can lead to inadvertently repeating an operation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Explain the FormTagHelper class

A
The FormTagHelper class is the built-in tag helper for form elements and is used to manage the configuration of HTML forms so that they target the right action or page handler without the need to hard-code URLs. 
The FormTagHelper transforms form elements so they target an action method or Razor Page without the need for hard-coded URLs. The attributes supported by this tag helper work in the same way as for anchor elements, described in Chapter 26, and use attributes to provide values that help generate URLs through the ASP.NET Core routing system.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly