Want to Use Custom Validator To Check for Duplicate Record

G

Guest

We have 3 fields on our web form that makeup what could be a duplicate entry.
We would like to look at these three fields that the user enters and check
in the database to see the information in all three fields matches
information in the database. Can you do this in a custom validator?
 
C

Curt_C [MVP]

Sure you could... Give it a whirl and let us knwo where you get the
problem/issue.
 
L

Lucas Tam

How? We would like to have the message also displayed in the summary
validation.

Search the database. If there are multiple records, set Args.Isvalid =
False.


You can do ANYTHING in a custom validator. It basically executes any code
you place in there when a validation is called. Technically it doesn't even
need to do validation... you could use it for logging or whatever.
 
G

Guest

are you suggesting to have one custom validation or to validate on each of
the three fields?

We would like to have a red askerisks appear beside the three fields if a
duplicate record is found in the database. We would also like to have the
duplicate message displayed in the summary validation control.
 
L

Lucas Tam

are you suggesting to have one custom validation or to validate on
each of the three fields?

We would like to have a red askerisks appear beside the three fields
if a duplicate record is found in the database. We would also like to
have the duplicate message displayed in the summary validation
control.


Is each text field a separate validation? If so, I would use 3 validators.
Two reasons: 1. Errors will be displayed in the validation summary. 2. The
askteriks will be displayed automatically.


You could use 1 validator - in this case just put a label beside the other
fields and set the text to *. However, placing error text into the
Validation Summary maybe more difficult.
 
G

Guest

Another thing to mention is that it works when we have the summary validation
property set to showmessagebox = false, but we need it to be set to true. It
might be the way we are doing the validation. we have custom validation
controls that are set to false until are code runs and then sets them to
true, but the message box doesn't get displayed.

any suggestions would be helpful?
 
G

Guest

thanks for your suggestions.....

Lucas Tam said:
Is each text field a separate validation? If so, I would use 3 validators.
Two reasons: 1. Errors will be displayed in the validation summary. 2. The
askteriks will be displayed automatically.


You could use 1 validator - in this case just put a label beside the other
fields and set the text to *. However, placing error text into the
Validation Summary maybe more difficult.
 
G

Guest

We have it working now, but the only problem is that the message box doesn't
pop-up. Would there be any reason why this is happening?
 
L

Lucas Tam

We have it working now, but the only problem is that the message box
doesn't pop-up. Would there be any reason why this is happening?

If you have the new IE service pack loaded, it blocks pop-ups.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top