Support

Account

Home Forums Front-end Issues Targeting ACF fields only in acf.conditional_logic.calculate

Helping

Targeting ACF fields only in acf.conditional_logic.calculate

  • In input.js, line 636, there is a query finding an ACF field’s value to match against another field’s conditional logic rules:

    // get val and make sure it is an array
    var val = $field.find('input, textarea, select').last().val();

    As I use a third-party jQuery plugin (Chosen) that inserts an internal search input field (without a name attribute), the ACF conditional logic fails, as the last input field is that search field.

    I solved it by filtering the selection with .filter('[name^="field"]') before doing the last() filter, which might be a good solution to this problem.

  • Hi @alexanderwallin

    Thanks, I like the JS and I’ll add it in.

    Cheers
    E

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Targeting ACF fields only in acf.conditional_logic.calculate’ is closed to new replies.