Support

Account

Home Forums Add-ons Repeater Field Repeater entries from front end post won't save

Solved

Repeater entries from front end post won't save

  • Hello,

    I created a front end form to test getting feedback from people. It has a couple issues.

    1. It has a repeater in it that doesn’t save any values from any fields I add to it. If I add a text field into the form but not in the repeater that text field does save.

    2. Whenever I refresh the page it saves a new post, rather than on submit.

    Any ideas what the issue is?

    Thanks!

    Edit: Things do work properly in the back end.

  • Hi @rivage

    Could you please share the complete code of the template? If it’s too long, you can share it here: https://gist.github.com/.

    Also, could you please share the JSON or XML export file of your field group so I can test it out on my installation?

    Thanks 🙂

  • Hi James!

    Thank you so much for your help!!!

    https://gist.github.com/ty2u/b4ce1e251a0ead2ebb2c6ae69c407774

    Hopefully it makes sense to you.

    #1 still seems to have issues but I’m thinking #2 is a browser feature/bug because I can now only reproduce it sometimes and it goes away after I close the browser and open it again, which incidentally required me to retype this whole post haha.

    Further inspection has proved #2 to be caused by the Inspector. Only when I open the Developer Tools/Inspector in Google Chrome it doesn’t ask to resubmit the form once it’s submitted the first time and then I try refreshing the page while the Inspector is open. The page just refreshes without the alert to ask if you want to resubmit it. If I close the Inspector and try to submit it then prompts me to continue or not again. I never noticed this feature before.

    I also tried some javascript mentioned on here https://www.advancedcustomfields.com/resources/acf_form/ that didn’t seem to do anything but I probably didn’t do it right:

    jQuery(document).ready(function () {
    	"use strict";
    
    	// frontend feedback acf form
    	if(jQuery("div[id^='feedback-entry-']").length > 0) {
    		acf.do_action('append', jQuery('#acf-form'));
    	}
    });
    

    I also tried this in functions.php instead of the above js to no avail:

    
    add_action( 'wp_head', 'add_acf_js' );
    function add_acf_js() {
    	echo '<script>(function($) {
    	
    	// setup fields
    	acf.do_action("append", $("#acf-form"));
    	
    })(jQuery);	
    </script>';
    }
    

    Thanks again!

  • Just an update to confirm that it still doesn’t work in ACF 5.5.3.

  • OK I figured it out. My fault! Sorry.

    I had an extra line calling the acf/update_value filter in the page template hooked to the wrong function.

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

You must be logged in to reply to this topic.