In a form, if dropdown value is x then grey out button

I’m new to coding and Corvid.

I am making a website for a doctor and in the contact form I need:

  • if a person is from a selected health insurance (let’s say XYZ, selected from a dropdown), the send button greys out and a text shows up saying “For users of the XYZ Health Insurance, please contact us by phone.”

I have the form ready with the dropdown, send button and text (set as hidden on load), but I have no idea about the code.

Can anybody help me?

Obviously, you will need to substitute the real element names, but this will achieve what you are after. Just create a dropdown change event code block in the property sheet while the dropdown is selected.

export function dropdown1_change(event) {
    if (event.target.value === "XYZ"){
        $w("#button1").disable();
        $w("#text1").show();
    } else {
        $w("#button1").enable();
        $w("#text1").hide();
    }
}

Perfect!!! Worked like a charm! Thank you very much!!!