Help

Check if a record exists on database before submitting a form

Solved
Jump to Solution
3313 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Israel_Garza
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi, 

I am looking into options or workarounds to check if a value of a record exists in database before submitting a form. Is there a third party software or tool that is compatible with Airtable to do this? or is there any workaround with an automation to submit the form and check if record exists. If it does not exist, open again the form and show an error message to fill out a correct email. 

I would appreciate any suggestions.

Thank you.

1 Solution

Accepted Solutions
Anthony
6 - Interface Innovator
6 - Interface Innovator

Another thought - the above method is not very good if you don't want to show all of your data.

A sort of way round this is to create a prefilled form to a table that references itself. If you conditionally hide input fields depending on whether the "self reference" found anything you mimick the sort of behaviour you are after.

I built a test table with a form to demonstrate this: https://airtable.com/shrTI0mcro0PkSRQO

The issue is that you need a way to get the user to generate the bespoke urls that would pre-populate the form (https://support.airtable.com/docs/prefilling-a-form)

Here is a code-pen working example of how to do this (which links to the base above) https://codepen.io/anthony_zero/pen/XWByLqX

You can see that if you enter a reference such as "a1" that already exists in the table, the form won't show input fields. If you enter a reference that does not exist "random text here" then you are shown the input fields.

A few caveats:

  • this is still a low security method because it is easy to expose all of the reference field data by manually tweaking the airtable form url
  • it doesn't stop the user submitting a blank (or nearly blank) record if they ignore the instructions and go ahead and click submit

See Solution in Thread

3 Replies 3
Anthony
6 - Interface Innovator
6 - Interface Innovator

By chance I have been considering the same question today, here is a possible solution:

Create two forms, one for a dummy table that links to the table you are really interested in. The form just shows the linked record field.

The second form is the real one.

Embed both in your own simple static webpage, form 1 above form 2. Instructions to say if you can't find the record in the first section add it using the second section.

Problem is that you need the webpage to host it, and you are at risk of spamming if you cannot find a way to obscure the site. I'm considering this method myself so if anyone else can point out other drawbacks would be interested to hear!

Anthony
6 - Interface Innovator
6 - Interface Innovator

Another thought - the above method is not very good if you don't want to show all of your data.

A sort of way round this is to create a prefilled form to a table that references itself. If you conditionally hide input fields depending on whether the "self reference" found anything you mimick the sort of behaviour you are after.

I built a test table with a form to demonstrate this: https://airtable.com/shrTI0mcro0PkSRQO

The issue is that you need a way to get the user to generate the bespoke urls that would pre-populate the form (https://support.airtable.com/docs/prefilling-a-form)

Here is a code-pen working example of how to do this (which links to the base above) https://codepen.io/anthony_zero/pen/XWByLqX

You can see that if you enter a reference such as "a1" that already exists in the table, the form won't show input fields. If you enter a reference that does not exist "random text here" then you are shown the input fields.

A few caveats:

  • this is still a low security method because it is easy to expose all of the reference field data by manually tweaking the airtable form url
  • it doesn't stop the user submitting a blank (or nearly blank) record if they ignore the instructions and go ahead and click submit

Hi Anthony,

I tried and I think that's the best solution we have until now. Thanks for the suggestions.