Field Validation

Hello!

I think I know the answer to my questions but need a sanity check.

I’ve built a custom form with the intent of calling the Wix-Pay API and then recording the transaction (form data + payment) upon submit.

Before calling the Wix-Pay API I validate my form.

I’ve successfully implemented a function that does the following:

  1. Updates the visual state of the fields (i.e., puts them in/out of an error state) via the updateValidityIndication( ) function.

  2. Then, starting at the top of the form, I determine if the field has an error and if yes I set the focus to that field. I’m doing this via checking if validity.valid is true/false, then setting focus.

:white_check_mark: All the above is working as expected.

:question: My first question is about error messages. I fully understand the onCustomValidation() function, but is that the only way to trigger displaying of error messages? For example, a required field error message, which seems to be native in Wix (i.e., the field settings & validity. valueMissing) and is detected by the updateValidityIndication( ) function.

:question: My second question has to do with field setting Input Type, specifically email and phone. I get the impression, the Input Type setting is supposed to enforce some validation patter related to the selected type, is this true? If yes, does anyone know the rules/patters behind it? I’m seeing some inconsistencies.