data validation
data validation
I was trying to validate a form with the following code:
- if (count(Address[Address_Name == input.Address_Name && client_code == input.client_code]) > 0)
- {
- alert ("An address with the name already exists for this client. Please enter a new name.");
- cancel submit;
- }
But it is not working. Sometime the validation works and throws the alert and sometimes the user can enter the data successfully. I thought it was a really easy validation.
Am I doing something wrong or there is something wrong with my application? The only possible problem I can see in this code is:
- Address[Address_Name == input.Address_Name && client_code == input.client_code]
Can I do something like this? Or I will have to do this:
- Address[client_code == input.client_code]
and fetch all the records and inside a loop check for the address name?