How to verify data entered by the user prior to submitting form

Hello there everyone let me explain you what I exactly want to do
I have a form with some basic details and referral ID. Please note the referral ID is members unique “ID”


Now the feature I want is that whenever a person submit form with referral ID I want two verification to be done
Condition 1: ID is valid or exist in members database
Condition 2: Current logged in user ID should not be same as entered referral ID

If both condition is true then proceed booking
else if first condition is false then show "Invalid referral ID ".
if second condition is false then show “You can’t use your own referral ID”


Can anyone guide me how to create such type of hooks in database? Please

That is a heck of a long referral number!

Have a look at Nayeli (Code Queen) tutorial here as she has done a very similar tutorial to what you are after.
https://codequeen.wixsite.com/membership-dashboard
https://www.youtube.com/watch?v=yLCOqsVHhD0 - Youtube vid for the tutorial, it will play even though it shows an error message on load, just wait a few moments and it will play.

As for the validations options, then check out this already prepared Wix tutorial about custom validations and it will show you in Wix Editor how it is all setup with elements and code already added.
https://www.wix.com/corvid/example/custom-validations

can you explain me more about “validation” ?

If you look at the Wix ValidatableMixin API here.
https://www.wix.com/corvid/reference/$w.ValidatableMixin.html

The Wix Tutorial here.
https://www.wix.com/corvid/example/custom-validations

Plus, the info page here.
https://support.wix.com/en/article/corvid-about-validating-user-input-with-code

Then that should give you a good example and meaning as to what it is all about, so that you can look at implementing it into your own website.

If you want to read up about datahooks and working with them through your Backend, then read here.
https://www.wix.com/corvid/reference/wix-data.Hooks.html
https://support.wix.com/en/article/corvid-using-data-hooks
https://support.wix.com/en/article/corvid-about-data-hooks
https://support.wix.com/en/article/corvid-tutorial-processing-user-input-before-it-is-stored-in-a-collection-with-data-hooks

You can also do an option called onBeforeSave through your dataset too with code as shown here.
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#onBeforeSave

Or onAfterSave with your dataset after everything has been saved as shown here.
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#onAfterSave