Updated documentation.
This commit is contained in:
parent
26234c29a8
commit
5f66b0ee71
1 changed files with 3 additions and 3 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue