Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Form] Ability to clear form errors#9916

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 3 commits intosymfony:masterfromcolinodell:feature/clearable-forms
Jun 25, 2018
Merged

[Form] Ability to clear form errors#9916

javiereguiluz merged 3 commits intosymfony:masterfromcolinodell:feature/clearable-forms
Jun 25, 2018

Conversation

@colinodell
Copy link
Contributor

Documenting the new feature proposed insymfony/symfony#27580

Clearing Form Errors
~~~~~~~~~~~~~~~~~~~~

Any errors can be manually cleared using the:method:`Symfony\\Component\\Form\\ClearableErrorInterface::clearErrors` method. This is useful when you'd like to validate the form without showing validation errors to the user (i.e. during a partial AJAX submission or:doc:`dynamic form modification</form/dynamic_form_modification>`).
Copy link
Member

Choose a reason for hiding this comment

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

ClearableErrorsInterface?s

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Good catch! I renamed the interface but forgot to update the docs. Fixed and amended!

Clearing Form Errors
~~~~~~~~~~~~~~~~~~~~

Any errors can be manually cleared using the:method:`Symfony\\Component\\Form\\ClearableErrorsInterface::clearErrors` method. This is useful when you'd like to validate the form without showing validation errors to the user (i.e. during a partial AJAX submission or:doc:`dynamic form modification</form/dynamic_form_modification>`).
Copy link
Contributor

Choose a reason for hiding this comment

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

We should precise that clearing the errors makes the form valid. SoclearErrors() should be called after testing if the form is valid or at least not rely on its state.

yceruto reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I have added a new sentence to clarify that. Thanks!

HeahDude reacted with thumbs up emoji
Copy link
Contributor

@HeahDudeHeahDude left a comment

Choose a reason for hiding this comment

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

Thanks!

symfony-splitter pushed a commit to symfony/form that referenced this pull requestJun 25, 2018
This PR was squashed before being merged into the 4.2-dev branch (closes #27580).Discussion----------[Form] Add ability to clear form errors| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | #14060| License       | MIT| Doc PR        |symfony/symfony-docs#9916This PR adds the ability to manually clear form errors, thus improving the DX issue reported in #14060.Unlike my original approach in #14233 and #27571 which break BC, this adds a new `ClearableErrorInterface` which `Form` implements.  (`Button` does not implement it because buttons can't have errors.)Commits-------9eb755c07f [Form] Add ability to clear form errors
fabpot added a commit to symfony/symfony that referenced this pull requestJun 25, 2018
This PR was squashed before being merged into the 4.2-dev branch (closes#27580).Discussion----------[Form] Add ability to clear form errors| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#14060| License       | MIT| Doc PR        |symfony/symfony-docs#9916This PR adds the ability to manually clear form errors, thus improving the DX issue reported in#14060.Unlike my original approach in#14233 and#27571 which break BC, this adds a new `ClearableErrorInterface` which `Form` implements.  (`Button` does not implement it because buttons can't have errors.)Commits-------9eb755c [Form] Add ability to clear form errors
@javiereguiluzjaviereguiluz removed the Waiting Code MergeDocs for features pending to be merged labelJun 25, 2018
@javiereguiluz
Copy link
Member

@colinodell thanks for improving Forms DX with this new feature and thanks for providing the docs too. Everything is perfectly explained!

@javiereguiluzjaviereguiluz merged commitf07f536 intosymfony:masterJun 25, 2018
javiereguiluz added a commit that referenced this pull requestJun 25, 2018
…uiluz)This PR was merged into the master branch.Discussion----------[Form] Ability to clear form errorsDocumenting the new feature proposed insymfony/symfony#27580Commits-------f07f536 Wrap long lines and add the versionadded directive7a4465d Clarify that clearing errors makes the form validd4143f1 [Form] Ability to clear form errors
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

4 more reviewers

@ycerutoycerutoyceruto left review comments

@vudaltsovvudaltsovvudaltsov approved these changes

@HeahDudeHeahDudeHeahDude approved these changes

@maxheliasmaxheliasmaxhelias approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

8 participants

@colinodell@javiereguiluz@yceruto@vudaltsov@HeahDude@maxhelias@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp