Support

Account

Home Forums ACF PRO Updating select field value based on another field

Unread

Updating select field value based on another field

  • Hi, so i’m trying to automatically set the value of a field based on what user selected in the first one. This form is going to be used in the admin panel only so it doesn’t have to be pretty. Basically when user sets one of the titles from the “title” field I want the “description” field’s value to be set automatically so they’re kind of linked together. Below I paste a simplified code that does not work at all. Hope someone can point me in the right direction:

    
    add_action('acf/save_post', 'set_desc_acf', 15);
    function set_desc_acf($post_id) {
    	$title= get_field('title');
    	if($title == "Something"){
    		update_field('description', 'Example Desc', $post_id);
    	}
    }
    
Viewing 1 post (of 1 total)

The topic ‘Updating select field value based on another field’ is closed to new replies.