some fixes. - #4
Merged
Merged
Conversation
A Submit or Button element with a value but no name triggered "Use of uninitialized value $root in hash element" on every submitted form, because Button sets force_default(1) and Field::process_input passed the undefined nested_name to set_nested_hash_value. The string renderers for Select, Textarea, Checkboxgroup (and so Radiogroup) and ContentButton also emitted name="" with a sprintf warning when the field had no name, and Date built sub-field names from the undefined parent name. They now omit the name attribute, matching the existing behaviour of the Input role. The name() setter also accepts undef without a pattern-match warning. Adds t/elements/unnamed_fields.t which traps warnings while processing and rendering a form containing each affected element type. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…RT#45409)
A constraint such as
when: { field: some_checkbox, values: [x], not: 1 }
was skipped whenever the checkbox was unchecked, because an unchecked
checkbox submits nothing and _process_when returned false for a
missing field before consulting 'not'. Users had to set
default_empty_value on the checkbox to make 'not' work.
A missing field's undefined value is now treated as not matching, in
both the value-list and truthiness checks. With 'not' set that fulfils
the condition and the constraint is applied. Without 'not' a missing
'field' still skips the constraint as before.
Behaviour change: with 'fields', a missing field was previously
silently ignored and the remaining fields decided the outcome. It now
counts as not passing, matching the documented "all named fields'
values pass" semantics.
Documents the missing-field rule under field, fields and not, and adds
t/constraints/constraint_when_not_missing_field.t covering field,
fields and any_field, with and without not.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.