Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC Use FieldValidators for FormFieldValidation #621

Open
wants to merge 1 commit into
base: 6
Choose a base branch
from

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz marked this pull request as draft November 4, 2024 02:40
@emteknetnz emteknetnz force-pushed the pulls/6/form-field-valid branch 7 times, most recently from c27e818 to 74624d4 Compare November 12, 2024 23:13
@emteknetnz emteknetnz force-pushed the pulls/6/form-field-valid branch 2 times, most recently from 516d1fb to 53d015b Compare November 14, 2024 03:28
@emteknetnz emteknetnz marked this pull request as ready for review November 14, 2024 22:07
en/02_Developer_Guides/03_Forms/01_Validation.md Outdated Show resolved Hide resolved
en/02_Developer_Guides/03_Forms/01_Validation.md Outdated Show resolved Hide resolved
en/02_Developer_Guides/03_Forms/01_Validation.md Outdated Show resolved Hide resolved
en/02_Developer_Guides/03_Forms/01_Validation.md Outdated Show resolved Hide resolved
en/02_Developer_Guides/03_Forms/01_Validation.md Outdated Show resolved Hide resolved
en/08_Changelogs/6.0.0.md Outdated Show resolved Hide resolved
en/08_Changelogs/6.0.0.md Outdated Show resolved Hide resolved
en/08_Changelogs/6.0.0.md Outdated Show resolved Hide resolved
@emteknetnz emteknetnz force-pushed the pulls/6/form-field-valid branch 3 times, most recently from 7a78385 to 0d23732 Compare November 21, 2024 05:15
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor changes

en/02_Developer_Guides/03_Forms/01_Validation.md Outdated Show resolved Hide resolved
en/02_Developer_Guides/03_Forms/01_Validation.md Outdated Show resolved Hide resolved
en/02_Developer_Guides/03_Forms/01_Validation.md Outdated Show resolved Hide resolved
@emteknetnz emteknetnz force-pushed the pulls/6/form-field-valid branch 5 times, most recently from a171679 to 788373a Compare November 26, 2024 04:30
should trigger a validation error on the page) and pass this to the `extendValidationResult` method to allow extensions
to hook into the validation logic. In addition, in the event of failed validation, a useful error message must be set
on the given validator.
The `validate()` method returns a [`ValidationResult`](api:SilverStripe\Core\Validation\ValidationResult) object with any errors added to it, and should contain a useful error message. The `validate()` method should follow the example above and utilise the `$this->beforeExtending('updateValidate', ...` method and be followed by `return parent::validate();` in order for code in the parent class to be executed in the correct order.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `validate()` method returns a [`ValidationResult`](api:SilverStripe\Core\Validation\ValidationResult) object with any errors added to it, and should contain a useful error message. The `validate()` method should follow the example above and utilise the `$this->beforeExtending('updateValidate', ...` method and be followed by `return parent::validate();` in order for code in the parent class to be executed in the correct order.
The `validate()` method returns a [`ValidationResult`](api:SilverStripe\Core\Validation\ValidationResult) object with any errors added to it, and should contain a useful error message. The `validate()` method should follow the example above and utilise the `$this->beforeExtending('updateValidate', ...)` method and be followed by `return parent::validate();` in order for code in the parent class to be executed in the correct order.

As per #621 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants