deactivation / activation of the "send" button

how to write the code so that the “submit” button is not active until the required fields are filled in the form?
photo, this is just an example.

HI there :wave:t2: I do something similar on my site. Below is the basic structure that I use, you can adapt it to your needs.

$w('#email1, #password1').onChange(() => {
    if ($w('#email1').valid && $w('#password1').valid) {
        $w("#yourButton").enable();
    } else {
        $w("#yourButton").disable();
    }
})

Good luck!

Thank you for responding! I pasted the code, adjusted it to my fields. But the “send” button remained active. (

@5000101 First, don’t enable the send button by default.


Then , try this:

$w.onReady(function () {
    $w("#name").onChange(() => updateSubmitButtonStatus())
    $w("#email").onChange(() => updateSubmitButtonStatus())
    $w("#phone").onChange(() => updateSubmitButtonStatus())
    $w("#problem").onChange(() => updateSubmitButtonStatus())
    $w("#tellUs").onChange(() => updateSubmitButtonStatus())
});

function updateSubmitButtonStatus() {
    if (($w("#name").valid == true) && ($w("#email").valid == true) && ($w("#phone").valid == true) && ($w("#tellUs").valid == true)) {
        $w("#push").enable()
    }
}

Thank you kind person! Everything is super!) It works! I shake your hand!)