• When I add form like this https://mgibbs189.github.io/custom-field-suite/api/form.html I always get “CFS is not defined” error in console. After investigating back-end editing form, I found out that CFS()->form->load_assets(); is not adding one important piece of JS code on the front-end.
    So, in order to fix this issue, add this JS code before the form:

    <script>
    var CFS = CFS || {};
    CFS['get_field_value'] = {};
    CFS['loop_buffer'] = [];
    </script>

    Final PHP code example:

    CFS()->form->load_assets();
    echo '<script>var CFS = CFS || {};CFS["get_field_value"] = {};CFS["loop_buffer"] = [];</script>';
    echo CFS()->form( array(
    // your args...
    ) );

    Feel free to inject that JS on the page whichever way you want, just add it before form renders.

The topic ‘Fix for “CFS is not defined” console error.’ is closed to new replies.