Preventing Duplicate Records -- How to Defeat FMP's Unique Value Error Message Dialog Window
My goal is to have a scripted, custom, pop-up window appear after a user enters text into a text field (CompanyName__lxt) warning him/her that an identical company name already exists in another record.
Creating the pop-up window is no biggie. However, getting around FMP's built-in Validation > Unique Value error dialog box is the problem--I don't want it to appear, just my pop-up window. Yet, how can I have FMP validate/check for uniqueness?
In another thread in here somewhere, the Moderator suggested using the OnObjectVaildate function (with a script trigger) by way of this solution (http://sixfriedrice.com/wp/the-onobjectvalidate-trigger/) . I threw together their solution but I can't see how it would work with text, not a date, let alone look for an existing record with the same--in my case--company name.
TIA for your help!
A self join relation ship can match records on the CompanyName__lxt field. The script performed by the OnObjectValidate (or OnObjectSave) trigger can count the number of related records to identify duplicates. If you use OnObjectSave, don't select the unique values validation field option.