How can you set custom form validation?

Hi, I have two issues.

  1. When trying to set form validation for a field, I cannot find the option in the input element’s settings to introduce validation. This article ( https://support.wix.com/en/article/validating-user-input-with-settings ) says it should be possible but I just don’t see the option.
  2. When trying to do custom form validation with Corvid, my website does not flag invalid input and submits the form and takes the user to the next page. My code is below:
$w("#input5").onCustomValidation( (value, reject) => {
 if(value === "water") {
    reject("Water is not valid");

  }

} );

Alternatively, if I check that the input is not a certain value, it always returns that the input is wrong, even when it should be valid:

$w("#input5").onCustomValidation( (value, reject) => {
 if(value !== "water") {
    reject("Answer is incorrect");

  }

} );

Any help on either of these issues is much appreciated!

Hey,

What input element are you using? Not all of them will have custom validation options but if you click settings you should see the option at the bottom if it is available for that element.

When it comes to custom validation using Corvid we have a great example here that might help.

Hope this helps!

Dara | Corvid Team