• aliorg7

    (@aliorg7)


    Hi Fabian
    I am using ACF Pro along with Advanced Forms 1.7.1
    I have updated ACF Pro 5.9.4 to 5.9.5 and now validation is broken.

    The form works fine on staging as well as a local version that are using ACF 5.9.4

    one example is that in a multistep form, it passes the empty required fields and then won’t let users submit at the end because it will do validation at the end. My form uses heavy conditional logic and consists of more than 100 fields.
    Thanks
    Alex

    Edit: I rolled back to 5.9.4 and it works fine again. So you might not be able to see the error.

    • This topic was modified 4 years ago by aliorg7.
    • This topic was modified 4 years ago by aliorg7.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author fabianlindfors

    (@fabianlindfors)

    Hi!

    I’ve been testing ACF 5.9.5 in my local environment and haven’t yet been able to reproduce the validation problem. Could you tell me a bit more about validation is failing? Is it some specific field types or all fields? Only multi-page forms?

    Thank you!

    I’m also having problem with a form lately. I still haven’t been able to pinpoint the problem. I can’t submit a form, it always stops at the “Your submission failed. Please reload the page and try again.”

    You can view the problematic form here: https://alta.firmecreative.com/demande-de-soumission/

    The website is in staging, but nothing confidential. Feel free to submit the form as many times as you’d like. The nonce / sha256 decode doesn’t seem to be able to work, it never matches.

    How does it encode the value?

    I’m on latest 1.8 and latest ACF as well.

    Plugins installed :
    | acf-options-for-polylang | inactive | none | 1.1.8 |
    | advanced-forms | active | none | 1.8.0 |
    | bcm-duplicate-menu | active | none | 1.0.4 |
    | polylang | active | none | 3.0.3 |
    | wp-polylang-translate-rewrite-slug | active | none | 0.3.6 |
    | safe-svg | active | none | 1.9.9 |
    | duplicate-post | active | none | 4.1.2 |
    | wordpress-seo | active | available | 15.9.2 |
    | bedrock-autoloader | must-use | none | 1.0.1 |

    Plugins loaded through Bedrock’s must-use autoloader :
    Advanced Custom Fields : CPT Options Pages 2.0.6
    Advanced Custom Fields PRO 5.9.5
    Advanced Custom Fields: Editor Palette Field 1.0.7
    Advanced Custom Fields: SVG Icon 2.0.4
    Enable Media Replace 3.5.0
    Favicon by RealFaviconGenerator 1.3.20
    Intuitive Custom Post Order 3.1.2.1

    • This reply was modified 3 years, 10 months ago by davidwebca.

    I think I found the issue, so it might not be related to 5.9.5+ as I expected.

    My issue is with Polylang = the function “af_form_post_from_key” gets used to request the form submitted in “forms-submission.php” and this function uses a WP_Query which doesn’t contain the “lang” param used by Polylang.

    One would think that polylang’s filters would kick in and add that query param automatically to every custom post type that concerns it, but it doesn’t seem to be the case.

    2 possible solutions :

    1. af_form_post_from_key could be edited to include a language param. Adding a check for “ICL_LANGUAGE_CODE” would add compatibility with WPML and Polylang at the same time.
    2. We add a filter ourselves in all WP_Query calls that contain “af_form” to make sure we force the “lang” param correctly (possibly with pre_get_posts + some extra checks).

    I’m updating this post for myself lel (and in case someone’s running into the issue).

    In the end, forcing the translation of ‘af_form’ for polylang seems to solve the issue in a cleaner way. Some forms we didn’t want to translate for ease of use throughout the admin, but in the end, it’s way better to translate the damn thing.

    add_filter('pll_get_post_types', function($post_types, $hide) {
        $post_types['af_form'] = 'af_form';
        return $post_types;
    }, 10, 2);

    You’ll have to manually assign languages to the ones created before applying this code. Polylang doesn’t offer the option to tick “af_form” in the admin for some reason (must be marked as a hidden post type) and in such, we have to add this code to force it to be translatable.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Validation breaks after upgrade to ACF 5.9.5’ is closed to new replies.