Support

Account

Home Forums Front-end Issues acf_form action is empty

Solved

acf_form action is empty

  • I have created a frontend form for editing a CPT post. The form shows up great, everything looks fine, but clicking the ‘submit’ button doesn’t do anything.

    I’ve checked to be sure acf_form_head() was loading by commenting it out, checking the page, and seeing all the css go away. Removing the comment brings back all the styling, but doesn’t allow the submit button to work.

    I looked at the page source, and there is nothing for the ‘action’ attribute of the form.

    <form id="post" class="acf-form" action="" method="post">

    Is there something I’m not doing right?

    This is the code I’m using to call the form (acf_form_head() is at the very top of the template, before the header() call.)

    <?php
    			if ( is_user_logged_in() ):
    
    			    global $current_user;
    			    get_currentuserinfo();
    			    $author_query = array('post_type' => 'vendor','author' => $current_user->ID);
    			    $author_posts = new WP_Query($author_query);
    			    while($author_posts->have_posts()) : $author_posts->the_post();
    			    $id = get_the_ID();
    			    ?>
    			    <div id="advertiser-profile-form">
            			<?php acf_form(array(
    						'post_id'	=> $id,
    						'post_title'	=> true,
    						'submit_value'	=> 'Update Profile!'
    					)); ?>
            		</div>  
            		<?php        
    			    endwhile;
    
    			else :
    
    			    echo "<h3>Login to edit your profile</h3>";
    				echo wp_login_form();
    
    			endif; ?>
    
  • The form tag does not need an action and not having one will not prevent a form from submitting.

    There are two other possibilities to check.

    Make sure that your them has wp_footer(); in the correct place

    The other thing that can cause the submission to fail is a JavaScript Error or a PHP error during the AJAX call. Check that there are no JS errors and turn on error debugging and logging to see if any PHP errors are occurring during the AJAX call. https://codex.wordpress.org/WP_DEBUG

  • It was a conflict with a plugin. We had initially thought the use of https://wedevs.com/products/plugins/wp-user-frontend-pro/ was what would be needed, and so it was still activated. Upon deactivating it, everything is working fine.

    Thanks!

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

The topic ‘acf_form action is empty’ is closed to new replies.