Support

Account

Home Forums Front-end Issues Form on frontend conflicting with Datatables

Solved

Form on frontend conflicting with Datatables

  • I have a weird scenario. I am currently loading a Datatables table and a Fullcalendar calendar and an acf form on a template page. The template page is made for the single.php of each custom post type such as, cases, staff, clients. Everything on the cases CPT works and loads great, but on the other post types it is not working. I have noticed that when I remove the ACF form on the non working templates, it fixes the other problems. Please let me know what You need from me to help.

    Here is an example of the code that I am using to display the ACF form:

    <?php
    	if ( ( is_user_logged_in() && $current_user->ID == $post->post_author ) ) {
    		echo "<div class='acf-edit-post'>";
    			 acf_form(array(
    				 'field_groups' => array(209), // Used ID of the field groups here.
    				 'post_title' => true, // This will show the title filed
    				 'post_content' => false, // This will show the content field
    				 'form' => true,
    				 'return' => '%post_url%',
    				 'submit_value' => 'Save Changes',
    			));
    		echo "</div>";
    	}
    ?>

    And here is the top of each template file:

    <?php acf_form_head(); ?>
    <?php get_header(); ?>
  • I have found the solution to this on my own. It turns out that the scripts for datatables was not loading on certain pages for some reason. I was able to fix this by adding them directly to the template file. Not the best option but it works for now and is certainly not an ACF issue so I will say this is resolved. Thanks for looking!

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

The topic ‘Form on frontend conflicting with Datatables’ is closed to new replies.