Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DomCrawler] Skip disabled fields processing in Form#34059
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
sbogx commentedOct 22, 2019
| Q | A |
|---|---|
| Branch? | 3.4 |
| Bug fix? | yes |
| New feature? | no |
| Deprecations? | no |
| Tickets | Fix#28179 |
| License | MIT |
nicolas-grekas commentedJan 4, 2020
Can you give us more details as to why this is needed? |
sbogx commentedJan 6, 2020
It is indeed a behaviour change. Normally if a field is disabled in a form, it is completely ignored and that's what I intended to fix with the changes. |
sbogx commentedJan 6, 2020
@nicolas-grekas , I created the following mini-repo for demoing the issuehttps://github.com/sbogx/DomCrawler-disabled |
fabpot commentedFeb 3, 2020
Thank you@sbogx. |
This PR was merged into the 3.4 branch.Discussion----------[DomCrawler] Skip disabled fields processing in Form| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#28179| License | MITCommits-------c73b042 bug#28179 [DomCrawler] Skip disabled fields processing in Form
alexpott commentedMar 3, 2020
In light of#35923 I think we should consider reverting this. Maybe to fix the original poster's problem we need to detect when multiple fields have the same name and enact some logic? |
sbogx commentedMar 3, 2020
Hi@alexpott, the point of the DomCrawler is to simulate a normal functioning form, this change ensures this behaviour when processing disabled fields. I recommend checking the example repo. |
alexpott commentedMar 3, 2020
@sbogx well then this fix requires changes to a lot of things that use domcrawler for example \Behat\Mink\Driver\BrowserKitDriver::isChecked(). I'm not sure that I agree that sole purpose of the
To quote the readme it's purpose is to
This change has broken the ability to navigate the DOM for disabled fields and check their values. |
nicolas-grekas commentedMar 3, 2020
We should revert the PR for sure. Changing behavior and affecting legit use cases should not happen in a bugfix release. |
…ssing in Form" (dmaicher)This PR was merged into the 3.4 branch.Discussion----------Revert "bug#28179 [DomCrawler] Skip disabled fields processing in Form"| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |#35923| License | MIT| Doc PR | -Reverts#34059See#35923Commits-------af17f5a Revert "bug#28179 [DomCrawler] Skip disabled fields processing in Form"
Lock on the previous version 4.4.4 which was working as expected.Ref.symfony/symfony#34059
pfrenssen commentedMar 3, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Disabled form fields are perfectly normal and should be supported by dom-crawler. I checked the demo repohttps://github.com/sbogx/DomCrawler-disabled and dom-crawler already has support for selecting those fields. Selecting the enabled element
Selecting the disabled element
The test case is doing the following: but since Note that it is allowed in HTML to have identical names for different form elements, regardless whether or not some of those fields are disabled. This is also valid HTML: In the above example you also don't get the expected results back from |
sbogx commentedMar 10, 2020
@pfrenssen My issue was not whether DomCrawler should or should not support disabled fields. I know how the implementation works and how to get a specific disabled input. The issue that this PR is trying to fix is to make the The problem originates from In this case, maybe it would be better to have a new, separate collection of values that will be used by |
pfrenssen commentedMar 10, 2020
The Submitting of forms is not handled by this object but by client side code (e.g. Codeception). The In real life if a form is submitted containing multiple fields with the same name, then the value of the last defined field is submitted, and all others are discarded. So a proper fix could be something like this: |
pfrenssen commentedMar 10, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hmm I tried it and it has the same result. It seems |