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.
Forms- Validation message if value already exists in database
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.
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.