Update checkbox field or radio button based on conditions