How to make custom email validation

In this topic, we’ll look at how easy it is to make custom email validation.

Structure
For example, the page has an input, a button and an error text.

Logic
And add logic on button click. For this we need click on the puzzle:
image

On click event write logic like this:


The real regular schedule for checking email is very large, and for our case this one will be enough
^\S+@\S+\.\S+$

Also, In this example, the logic of the disabled button is implemented as long as the input is empty.
image

Now, when you click on the button, if the email is not correct, an error message will be displayed.

Let’s remove the error message if you started writing in the input. Jump into the input logic for a change event
image

Demo

That’s all there is to it! We hope that you found this useful and, as always, happy Codeless coding!

Suggestion for Team Backendless: for Input components, have an extra option for type" “other”. If chosen, give people a logic area where they can customize things themselves.

For example, it would be awesome to have a field for users to enter the price of something… “Number” doesn’t quite do the job — yes, it prevents non-numeric characters from being entered… but it allows negative numbers, and it allows user to input numbers that have more than two decimal places… like “-9.123456”. Just an idea :slight_smile:

@Alex_Klein thank you for the suggestion! We’ve missed it, sorry.
I will discuss with the team your idea.