Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Added ability to clear form errors #14233

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

Closed
wants to merge 1 commit into from
Closed

[Form] Added ability to clear form errors #14233

wants to merge 1 commit into from

Conversation

colinodell
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? yes
Deprecations? no
Tests pass? yes
Fixed tickets #14060
License MIT
Doc PR symfony/symfony-docs#5152

* Travis seems to be failing some builds for an unrelated reason

TODO:

  • Ensure Travis tests pass
  • Add/update relevant documentation

Summary:

This PR adds the ability to manually clear form errors, thus improving the DX issue reported in #14060.

@dosten
Copy link
Contributor

dosten commented Apr 6, 2015

I think this can be added to 2.7 without problems.

@colinodell
Copy link
Contributor Author

@dosten I was thinking it's a BC break because it adds a new method to an interface; any existing code implementing that interface would break unless they implemented this method.

@colinodell
Copy link
Contributor Author

Travis seems to be failing some builds but I think my unit tests are passing.

@dosten
Copy link
Contributor

dosten commented Apr 6, 2015

@colinodell Following the BC promise (http://symfony.com/doc/current/contributing/code/bc.html#changing-interfaces) and as of the FormInterface isn't tagged as @api you can add the clearErrors method without problems.

@wouterj
Copy link
Member

wouterj commented Apr 6, 2015

@dosten: with some problems, check footnote 2:

Should be avoided. When done, this change must be documented in the UPGRADE file.

@colinodell
Copy link
Contributor Author

The required tests now pass after rebasing onto the latest master.

I'd prefer to keep this targeted for 3.0/master unless a core dev advises otherwise.

(The BC-break could be avoiding by delaying the interface change until 3.0, but then you'd have to check method_exists on each child which seems too dirty.)

@stof
Copy link
Member

stof commented Apr 7, 2015

I'm not a fan of adding this method in the FormInterface. It is here for a very specific use case, and this one can already be solved in different ways IMO: #14060

@xabbuh xabbuh added the Form label Apr 21, 2015
@webmozart webmozart changed the title [DX] [Form] Added ability to clear form errors [Form] Added ability to clear form errors Jun 19, 2015
@webmozart
Copy link
Contributor

Closing since the original ticket was closed as well: #14060

@mcorteel
Copy link
Contributor

It was reopened by @fabpot a few days ago though!

@TerjeBr
Copy link

TerjeBr commented Jun 7, 2018

@webmozart could you please reopen this?

#14060 has been reopened, and it would be good to have this as an open PR to go with it.

@xabbuh
Copy link
Member

xabbuh commented Jun 7, 2018

FYI, we cannot reopen the PR as the repository this was based on has been deleted in the meantime.

fabpot added a commit that referenced this pull request Jun 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#9916

This 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants