Support

Account

Home Forums Add-ons Repeater Field Create a repeater row based on input

Unread

Create a repeater row based on input

  • Hi,

    I have two field groups, one is a repeater field group and the other is a form field group. I have had a look at the add_row() function but not sure how to implement it or if it is even possible. I would like to add a row based on an input from the second field group.

    repeater field :

            <?php if( have_rows('category_lists') ): ?>
            <ul class="grid">
              <?php while( have_rows('category_lists') ): the_row(); ?>
              <?php
    	
    	   $title = get_sub_field('title');
    	   $category = get_sub_field('category');
    	   $icon = get_sub_field('icon');
    	?>
    
             <?php endwhile; ?>
            </ul>
            <?php endif; ?>

    and my form

            <?php
    	
    	acf_form(array(
    		'post_id'		=> 'new_post',
    		'post_title'	=> true,
    		'post_content'	=> true,
    		//'post_taxonomy' => true,
    		'new_post'		=> array(
    			'post_type'		=> 'repository',
    			'post_status'	=> 'publish'
    		),
    		'submit_value'		=> 'Upload new document',
    		'return' => '%post_url%',
    	));
    	
    	?>
Viewing 1 post (of 1 total)

The topic ‘Create a repeater row based on input’ is closed to new replies.