What kind of validation on a component would prevent a form from submitting a record that already exists in the spreadsheet?
What type of data are you using to validate that it has “existed”?
Names for example
This is kind of a prevent conflicts booking app I have done so here’s the point.
If you don’t want an existing record to be submitted again, you must have a 2-step “form” to prevent access to submission if that record has already existed, using a relation.
In the first screen, make a details layout and add entry components you would need in a normal form. You don’t need to have it all, this all depends on how you would think the UX will be best for your case.
For example, I will have a name entry writing to a user-specific column. Create a relation linking it back to the sheets that contains all the records, matching the “Names” column.
If the relation is not empty (hence a record with that name has been submitted), show a text warning the user to change the name. If the relation is empty, show the form button.
In the form, record the name and all other things you need in the previous screen, then add more entries in the form before submission.
I hope it helps.
For our brand names, I added two more formula columns in the Google Sheet:
- One that converts everything to LOWER case and regexreplace’d all special characters away
- And another that does a COUNTIF comparing the 1st column with the actual data column. If count of 1st column > 1, result = 1. If no duplicates, count = 0.
As for the logic, if 2nd column = 0, show the Submit/Edit button. If 2nd column = 1, then show the Incomplete Profile button with matching notification.
Same principle for numbers. Take out all the extemporaneous characters, keep the numbers. Compare. Voila.
If you use a custom form, it’s quite easy to detect duplicates in real time and disallow form submission.
This concept app demonstrates how…