Updated documentation.
This commit is contained in:
parent
afa8b5d2cc
commit
7d85ff0b08
@ -676,21 +676,21 @@ if err := form.Set(ctx, &input); err != nil {
|
|||||||
|
|
||||||
Process the submission which uses [validator](https://github.com/go-playground/validator) to check for validation errors:
|
Process the submission which uses [validator](https://github.com/go-playground/validator) to check for validation errors:
|
||||||
```go
|
```go
|
||||||
if err := form.Submission.Process(ctx, form); err != nil {
|
if err := input.Submission.Process(ctx, input); err != nil {
|
||||||
// Something went wrong...
|
// Something went wrong...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Check if the form submission has any validation errors:
|
Check if the form submission has any validation errors:
|
||||||
```go
|
```go
|
||||||
if !form.Submission.HasErrors() {
|
if !input.Submission.HasErrors() {
|
||||||
// All good, now execute something!
|
// All good, now execute something!
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
In the event of a validation error, you most likely want to re-render the form with the values provided and any error messages. Since you stored a pointer to the _form_ in the context in the first step, you can first have the _POST_ handler call the _GET_:
|
In the event of a validation error, you most likely want to re-render the form with the values provided and any error messages. Since you stored a pointer to the _form_ in the context in the first step, you can first have the _POST_ handler call the _GET_:
|
||||||
```go
|
```go
|
||||||
if form.Submission.HasErrors() {
|
if input.Submission.HasErrors() {
|
||||||
return c.GetCallback(ctx)
|
return c.GetCallback(ctx)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user