Hello.
I have a table with the fields "name" and "surname"
I created a "name_surname" field in which the fields "name" and "surname" are automatically concatenated.
The "name_surname" field is set as unique.
I would like if an "name_surname" field already present in the table appears as an error message such as "this name is already present in the database - it is not possible to re-register an already present name. Cancel the creation of this record and modify the record related to the name already registered "
How can I do?
Thank you!!!
Fabiano
create a custom error message if a field's data already exists and prevent the record from being saved
Re: create a custom error message if a field's data already exists and prevent the record from being saved
Hi Fabiano,
I suggest you use a hook (before_insert). Just test if name_surename already exists, if not, show some JS error and cancel the insert.
BTW: Are you sure, that name_surename is unique?
Olaf
I suggest you use a hook (before_insert). Just test if name_surename already exists, if not, show some JS error and cancel the insert.
BTW: Are you sure, that name_surename is unique?
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: create a custom error message if a field's data already exists and prevent the record from being saved
Hi fgazza,
please see my solution here: viewtopic.php?f=7&t=1740&p=10906#p10906
Does this fir your needs?
Olaf
please see my solution here: viewtopic.php?f=7&t=1740&p=10906#p10906
Does this fir your needs?
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view