How to prevent submiting duplicate existing e-mail record in a catalog item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 08:53 AM
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:
This is the Client Script:
Does anyone knows how to solve this?
Tks!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 12:16 PM
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') ?