Support

Account

Home Forums Add-ons Repeater Field Trying to get values from nested repeater in admin area Reply To: Trying to get values from nested repeater in admin area

  • The code I originally posted was not 100%, I missed an error when copying your original code

    
    add_action('wp_ajax_email_sender', 'email_sender');
    function email_sender($field) {
       // move this to the top
        $post_id = $_POST["post_id"];
    
        if( have_rows('day_repeater', $post_id) ):
            // loop through the rows of data
            while ( have_rows('day_repeater', $post_id) ) : the_row();
    
            $date = get_sub_field('date'); // I need values from this field
            
                // LOOP FOR NESTED REPEATER FIELD
                if ( get_field('accommondation') ):
                   // next line changed
                    while( have_rows('accommondation') ) : the_row();
                    
                    $notes = the_sub_field('notes'); // I need values from this field
    
                    endwhile;
                endif;
            endwhile;
        endif;
    

    There isn’t really a way to get the specific row other than to get the values from that row using JavaScript and submit them as part of your ajax request.