Support

Account

Home Forums Bug Reports Choice field "Other" Repeater Issue Reply To: Choice field "Other" Repeater Issue

  • Hi Ria

    Elliot here – ACF dev.

    Thanks for the bug report.

    I’ve got some code for you to test if that’s ok.

    Can you please edit the file: fields/radio.php and replace the following function:

    
    function update_value( $value, $post_id, $field ) {
    		
    		// bail early if no value (allow 0 to be saved)
    		if( !$value && !is_numeric($value) ) return $value;
    		
    		
    		// save_other_choice
    		if( $field['save_other_choice'] ) {
    			
    			// value isn't in choices yet
    			if( !isset($field['choices'][ $value ]) ) {
    				
    				// get raw $field (may have been changed via repeater field)
    				// if field is local, it won't have an ID
    				$selector = $field['ID'] ? $field['ID'] : $field['key'];
    				$field = acf_get_field( $selector, true );
    				
    				
    				// bail early if no ID (JSON only)
    				if( !$field['ID'] ) return $value;
    				
    				
    				// update $field
    				$field['choices'][ $value ] = $value;
    				
    				
    				// save
    				acf_update_field( $field );
    				
    			}
    			
    		}		
    		
    		
    		// return
    		return $value;
    	}
    

    Try the problem again and let me know if it solves it.

    Thanks
    E