Support

Account

Home Forums Front-end Issues only show updated_message on single form

Unread

only show updated_message on single form

  • Hi,
    I am using multiple forms on a single page – while I know this is not best practice it is working correctly and allows a user to update a single custom field for each of their associated stores.

    Currently when any of the forms are saved the return path updates the page url with “?updated=true” on reload which I understand, but this the fires the updated message on all the forms.

    Is there a way I could associate the update message only with the specific form that was updated??

    Here is the relevant part of my function which creates a new form for each matching store:

        //get array of posts where store_owner_id = userid
        $posts = get_posts(array(
            'fields' => 'ids',
            'numberposts'	=> -1,
            'post_type'		=> 'wpsl_stores',
            'meta_key'		=> 'wpsl_store_owner_id',
            'meta_value'	=> $uid
        ));
        //initialise the var  
        $form = '';
          
        foreach($posts as $post){
      
        $form .= '<div class="store-owner-store-wrapper">';
            
            $form .= '<h4>' . get_the_title($post). '</h4>'; 
            
            
                
                $field_groups = array(587);
    
                if ( ! empty ( $a['field_group'] ) && ! empty ( $uid ) ) {
                    $options = array(
                        'post_id' => $post,
                        'field_groups' => $field_groups,
                        'return' => add_query_arg( 'updated', 'true', get_permalink() ),
                        'submit_value' => 'Save',
                        'html_updated_message'  => '<div id="message" class="updated"><p>Store details updated</p></div>',
                    );
    	           
                    ob_start();
    
                    acf_form( $options );
                    $form .= ob_get_contents();
    
                    ob_end_clean();
              }
            
        $form .= '</div>';
    
        } //end loop
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.