How to prevent submiting duplicate existing e-mail record in a catalog item?

Jutorri
Tera Contributor

Hello friends! I Need to add a validation for the e-mail inserted in a User Account form, in a catalog item.

It need to check the email already exists and if so then it prints an error message, clears the field and does not submit untill the user insert new email. 

What happens is that when I insert existing email, it shows the error message and if I fill all other fields anyway and fill the email in the end and click submit, it submits the form anyway.

This is the Script Include:

Jutorri_0-1708620698510.png

This is the Client Script:

Jutorri_1-1708620735368.png

Does anyone knows how to solve this?

Tks!!!

1 REPLY 1

Tony Chatfield1
Kilo Patron

Hi, unfortunately screenshots do not allow code to be easily evaluated.

 

What are the results of your debugging?
Does your script-include run and return Boolean true\false as expected to 'x'.
What does your client script do with either result?

Have you tested the value\type of x?
If it is parsed from a JSON payload then I suspect it is a string, so if(x) could always return same result as you would not be testing the content of x.
What happens if you try if (x == 'true') ?