Home Forums Front-end Issues Not working scripts ACF logic


Not working scripts ACF logic

  • Hello!

    After moving elements have stopped working scripts ACF logic. Move the item in the form:

    how to get the scripts to work?

    p.s.: English is not the native language

    Template Name: ACF Form
    <div class="acf-grid">
        <div class="grid">
            <div class="col-3" id='category'></div>
            <div class="col-9 grid">
                <div class="col-12 grid">
                    <div class="col-6" id='cat-box'></div>
                    <div class="col-6"></div>
                <div class="col-12 grid">
                    <div class="col-6" id='adres'></div>
                    <div class="col-6" id='contacty'></div>
        <div class="grid">
            <div class="col-9" id='descriptions'></div>
            <div class="col-3" id='add-file'></div>
    $args = array(
        'post_id' => 'new_post',
        'new_post' => array(
            'post_type' => 'markers',
            'post_status' => 'draft',
        'post_title' => false,
        'submit_value' => 'Создать',
        'updated_message' => 'Ваша запись поставлена в очередь на модерацию'
    acf_form( $args );
    <script type="text/javascript">
        //$(document).ready(function() {	
        acf.add_action('ready', function( $el ){    
    <?php get_footer(); ?>
  • ACF’s JavaScript is based on the elements where they are located. Most likely it stops working because ACF cannot find what it’s looking for or the actions that are attached to element are no longer attached because they do not appear where they are expected to be. Basically, you cannot alter the way that ACF outputs the HTML structure of the field group.

  • Yes, I understand that. conditional logic handler does not see the displaced elements.

    is there a way to explicitly tell the handler to the elements?

  • No, If you’re going to move elements then you’ll need to write all your own JavaScript code to do what ACF should be doing.

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

The topic ‘Not working scripts ACF logic’ is closed to new replies.