You are viewing limited content. For full access, please sign in.

Question

Question

Forms- Validation message if value already exists in database

asked on July 31, 2020

In Laserfiche Forms, how can I get a message to display if a value already exists in the database? In my particular case, I have an invoice number field that has a lookup to a database. So as I start typing a number, the numbers that match start displaying. I want to be able to have a message tell me that the invoice number already exists if I happen to select one that is already part of the database. 

0 0

Replies

replied on July 31, 2020

It sounds like the invoice number field has an auto-complete feature, i assume you are utilizing it on a drop-down field populated by that lookup presumably with existing invoice numbers?

I don't think i quite understand the question the way its currently phrased, unless you have another table with a different set of invoice numbers you want to run that check against. In which case the way i'd approach this is by populating a hidden drop-down field with the invoice numbers that already exist, then write a callback function that runs once a selection has been made which will iterate over that hidden list <option> values and check for match. You can then display your error message as a custom bootstrap alert.

1 0
replied on August 6, 2020

This is how it displays on the form. So when I click on the Vendor Invoice # field, the lookup brings up values that exist in the database. If I select one of those, I want to display an error message saying that it already exists.

0 0
replied on August 3, 2020

You could have one field where the user enters in the invoice number, run a lookup based on the entered invoice number and fill another hidden field with some value if it exists. 

If invoice number matches invoice number (db column)
Fill hidden field with any other db column

Then use a custom error message or a field rule to show an HTML field with a warning if that hidden field is not blank. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.