I want to stop a customer from registering two times with same email address. I do not know how I can check the client's email address from the eCommerce registration page.
For example, when a client enters an email in the eCommerce registration page, check if the email was previously registered in the website or not.
If yes, don't let the customer register it again and show a message to the client.
Code that check the email address:
function clientValidateField(type, name, linenum){
var filter = new nlobjSearchFilter('email', null, 'is', givenEmail);
var result = nlapiSearchRecord('customer', null, filter, null);
return (results == null);
}
But I can't call it from client side.
You could make a Suitelet that can be accessed externally and returns a true or false given an email address, just call it within your client side code.
Alternatively, I guess you could prevent the creation of a customer record by creating a beforeSubmit UserEvent that checks if the email address exists and just throws an error.