Home Forums Front-end Issues Hide Fields on AJAX creation of form


Hide Fields on AJAX creation of form

  • I’m getting the form code from an API and injecting it in to my HTML. I’m using the acf.do_action( 'append', $form_container ); code in the form and it works for adding rows to repeater fields but it doesn’t hide fields that are suppose to be hidden initially. What else do I need to do?

    I have a checkbox that when checked, shows more fields. When the form is inserted, it shows all the hidden fields even though the checkbox isn’t selected.

  • Ok, it looks like if I run $form_container.trigger( 'acf/setup_fields' ); it hides the fields but takes a good 1-2 seconds to do so. Any way to minimize this timedelay?

  • Some how this has sorted itself out and I didn’t need the trigger after all.

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

You must be logged in to reply to this topic.