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

Optional AddressNL component gives "required" error message #5042

Closed
wants to merge 4 commits into from

Conversation

robinmolen
Copy link
Contributor

Partly closes #4699

Changes

The postcode and houseNumber fields didn't change their 'required' state depending on the addressNL component required state. This resulted in optional addressNL components requiring a postcode and houseNumber.

This PR sets the required and allow_blank field values of the postcode and houseNumber fields depending on the required state of the overarching addressNL component.

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Problem detection in the admin email digest is handled
  • Release management

    • I have labelled the PR as "needs-backport" accordingly
  • I have updated the translations assets (you do NOT need to provide translations)

    • Ran ./bin/makemessages_js.sh
    • Ran ./bin/compilemessages_js.sh
  • Dockerfile/scripts

    • Updated the Dockerfile with the necessary scripts from the ./bin folder
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how

The postcode and houseNumber weren't made `required` or `optional` depending on the `required` state of the addressNL component. These fields have/had only regex validation, and no `allow_blank` or any onther "optional" ruling. This resulted in the postcode and houseNumber fields to be always required.

With this change the `required` and `allow_blank` values for the postcode and houseNumber fields gets set depending on the required state of the over-arching addressNL component. This makes optional addressNL components correctly optional
@robinmolen robinmolen linked an issue Jan 27, 2025 that may be closed by this pull request
@robinmolen robinmolen marked this pull request as draft January 27, 2025 11:21
When the addressNL component is optional, the postcode and houseNumber fields should also be considered optional. But, if either postcode or houseNumber is provided, both fields become required
@robinmolen robinmolen marked this pull request as ready for review January 27, 2025 12:05
Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.67%. Comparing base (1658eca) to head (37ba8f1).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5042   +/-   ##
=======================================
  Coverage   96.67%   96.67%           
=======================================
  Files         765      765           
  Lines       26131    26140    +9     
  Branches     3407     3409    +2     
=======================================
+ Hits        25262    25271    +9     
  Misses        606      606           
  Partials      263      263           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@vaszig vaszig left a comment

Choose a reason for hiding this comment

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

Similar approach with mine in #5022. So I guess we can close this in favor of the other one which handles everything related in one place.

We prefer dealing with the translations during the release preparation (avoiding conflicts in the PRs as well)

@robinmolen
Copy link
Contributor Author

Similar approach with mine in #5022. So I guess we can close this in favor of the other one which handles everything related in one place.

We prefer dealing with the translations during the release preparation (avoiding conflicts in the PRs as well)

Yeah agreed, i'm closing this PR (and deleting the branch)

Check, I'll keep that in mind

@robinmolen robinmolen closed this Jan 28, 2025
@robinmolen robinmolen deleted the bug/4699-addressnl-validation branch January 28, 2025 15:35
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.

AddressNL validation on city & postcode issues
2 participants