Skip to content

Conversation

@OzanKurt
Copy link
Contributor

@OzanKurt OzanKurt commented May 7, 2025

What does this achieve?

This change ensures that the last input element with a given name is used when evaluating dependencies in custom validation logic.

This is important because, in HTML form submissions, the last matching input with the same name takes precedence when there are multiple inputs with the same name. A common example is when using a hidden input alongside a checkbox to provide a default value:

<input type="hidden" name="my_checkbox" value="0">
<input type="checkbox" name="my_checkbox" value="1">

This pattern is widely used to ensure a consistent value is submitted whether the checkbox is checked or not. If the checkbox is unchecked, only the hidden input (value="0") is submitted. If it is checked, both are submitted, but the checkbox value (1) takes precedence.

Without this fix, the validation logic incorrectly evaluates the first input (the hidden one), ignoring the actual user interaction with the checkbox. By using the last matching input, we align the validation behavior with how browsers and backends (like Laravel) interpret the submitted data.

@OzanKurt
Copy link
Contributor Author

OzanKurt commented May 8, 2025

@proengsoft

@bytestream bytestream changed the title Fixed dependentElement when there are multiple elements with the same… fix: align dependent element logic with server-side behaviour May 12, 2025
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.10%. Comparing base (eadeb21) to head (5bf9164).
Report is 37 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1062   +/-   ##
=========================================
  Coverage     97.10%   97.10%           
- Complexity      190      191    +1     
=========================================
  Files            18       18           
  Lines           519      519           
=========================================
  Hits            504      504           
  Misses           15       15           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bytestream bytestream merged commit da2638d into proengsoft:master May 12, 2025
15 of 16 checks passed
@jsvalidation-release
Copy link
Collaborator

🎉 This PR is included in version 4.10.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants