What's new

Welcome to xCrud Community - Data Management and extended PHP CRUD

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Validate a record by searching the database.

celticjoe

New member
Joined
Dec 2, 2022
Messages
4
Reaction score
2
Points
3
Location
Italy
I'm trying to port my old room booking application (meetings, video conferencing etc) to Xcrud; I'm missing the ability to validate a record not with a check on individual fields (which I found in Xcrud), but by looking through existing records if any meeting overlaps the new (or changed) meeting, as I did in the old application. The existing features (before_insert (callable, path) and before_update()), from what can be deduced from the documentation, don't seem to offer the possibility to stop data entry, only to modify data. The function should be able to return a description of the error and stop data entry.
Furthermore, as already requested by another user, it would be convenient for me to print the form (that is, the single record) as a reminder.
 

celticjoe

New member
Joined
Dec 2, 2022
Messages
4
Reaction score
2
Points
3
Location
Italy
If anyone is interested... I solved this problem: I didn't realize that there is a method set_exception( [fields] , [text], [message_type] ); in my case it was necessary to create a callback function in functions.php to be called via the before_update() and before_insert() methods.... Trivial, but I had to find out!
 

DaDo

Administrator
Staff member
Joined
Dec 1, 2021
Messages
108
Reaction score
23
Points
18
If anyone is interested... I solved this problem: I didn't realize that there is a method set_exception( [fields] , [text], [message_type] ); in my case it was necessary to create a callback function in functions.php to be called via the before_update() and before_insert() methods.... Trivial, but I had to find out!
Thanks for report this maybe explain using sample to user need this.
 
Top Bottom