• Hi, I have a question about Choices Callback in the Dropdown field. If you don’t use callback (the values are manually passed to the Edit Choices field) the field saves the value selected in the dropdown. But when you use callback the field is saved as an index of an array rather than the value. It makes no sense. The idea of using a callback is to use dynamic values. But with this behavior changing the callback (returning changed array) will generate all sorts of bugs (invalid references). Can I change that behavior?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @bcim

    Could you please share your the choices callback code so we can test it on our end?

    Regards,

    Thread Starter Krzysztof Rawski

    (@bcim)

    Im sorry but I can’t share my code (it uses to many dependencies). Use any callback that returns simple string[].

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @bcim

    It should save the key instead of the value/label. Is your callback array pattern similar to the below?

    $arr_fruits = [
       'apple' => 'Apple',
       'banana' => 'Banana',
    ];

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @bcim

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Choices Callback Dropdown’ is closed to new replies.