I need to make two input fields match (email & email confirmation) so the form will allow the submit button to be clicked.
I have coded something that disables the button but it does not enable when the fields match. I know very little in regards to coding so please excuse any mistakes.
$w.onReady(function () { $w("#getSubscribers1").onWixFormSubmit((event) => { if($w("#input1").value == $w("#input5").value){ $w("#button10").enable(); } else { $w("#button10") .disable(); } })});
Of course it doesn't get enabled. The enable-disable should be outside the onWixforSubmittion.
Something like:
$w.onReady(function () { $w("#input1, #input5").onInput(() => { $w("#input1").value === $w("#input5").value ? $w("#button10").enable() : $w("#button10") .disable(); }) //And just to be safe and not to rely only on the button state and to avoid unwanted submission define a validation rule: $w("#input5").onCustomValidation((value, reject) => { if($w("#input1").value !== value) { reject("no match"); } }); //end of validation rule })