AdvancedCustomFields / AdvancedCustomFields/acf

Radio Input `other` value is not valid when other_choice is disabled

Open
#51 2 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.