Add Other Option for Radio Input with Text Input

Goal: Add own option for radio input typable by the user. I wanna make a custom coded version of this functionality on Wix’s new forms


Working in Wix Editor

What I’ve tried so far: As a non coder I tried some code & it has issues

$w('#radioGroup2').onClick((event) => {

    const selectedValue = $w('#radioGroup2').value;
    const firstOptionValue = $w('#radioGroup2').options[0].value;
    const secondOptionValue = $w('#radioGroup2').options[1].value;

    if (selectedValue === secondOptionValue) { // Check if the second option is clicked
        $w("#input3").onChange((event) => {
            let textValue = $w("#input3").value; 
            $w("#radioGroup2").value = textValue; // Set the radio button group value to match
        });
    }
});

Issue: Clicking on a radio button fills the text input


I don’t want this, even if the 2nd choice is clicked. The text input should be unfilled with just the placeholder, until user fills it