AdvancedCustomFields / AdvancedCustomFields/acf
Radio Input `other` value is not valid when other_choice is disabled
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
Running ACF PRO 5.7.1 -
I have a radio field with other_choice set to 0 / off. One of the custom choice values we present is
other which triggers conditional logic on other fields.
If other_choice is set to 0, we'd expect a value of other to be valid or accept a null value. However, this now triggers an error in acf-input.js line 6868.
{Chrome}
Uncaught TypeError: this.inputText is not a function
at Child.getValue (acf-input.js?ver=5.7.1:6868)
at Child.val (acf-input.js?ver=5.7.1:4090)
at Child.match (acf-input.js?ver=5.7.1:9416)
at Child.calculate (acf-input.js?ver=5.7.1:8637)
at acf-input.js?ver=5.7.1:9047
at Array.filter (<anonymous>)
at acf-input.js?ver=5.7.1:9046
at Array.map (<anonymous>)
at Child.calculate (acf-input.js?ver=5.7.1:9040)
at Child.render (acf-input.js?ver=5.7.1:9023)
If the value of the field is set to other, there is an assumption that there is inputText() on the field, although in this case because other_choice is off, there is no inputText.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at acf-input.js line 6868 and follow the getValue, val, match, and calculate calls shown in the conditional-logic stack trace. Reproduce a radio field whose custom value is "other" while other_choice is disabled, then verify that the value is accepted or handled as null without the inputText TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100