How can I autofill a radio button based on two conditions?