PDA

View Full Version : Inform user in web / mobile app of why record coudl not be saved



avianmanagement
2020-10-26, 03:42
Web app for desktop and mobile in javascript

When saving a recored I want to call a vfp function via lianja.evaluate to check data before a save and not allow the save if the function returns false.

I want to use a vfp function, as I already have the code in a prg in my old app, on the database itself or perhaps in meta data so that I don't have to code it in the page itself and have code all over the place

My question is what is the best way to inform the user that the save could not be done.

For example adding and animal to my system and part of the data is the animals parents fk. Function would check if the animals birth date is after that of the parent and if the same or before inform the user that "The record could not be saved as animals birth date if before mothers birth date".

In the web I understand that the UI knows nothing about the backend and vice versa, so what's the best way to display this message in the UI to the user from code on the backend?

barrymavin
2020-10-26, 05:58
Hi David,

You can perform validation for the page in the "beforeupdate" or "beforecreate" page delegates. Individual fields can have validation and validationerrormessage specified in their attributes which can be inherited from the data dictionary attached to the table that the data bound column belongs to.

If these return true then the save is disallowed.

You can use Lianja.showErrorMessage() to inform the user.

avianmanagement
2020-10-26, 07:29
Thanks Barry

Did you mean section rather than page as I can see the beofre update on section but not page attributes?

I'll take a look at these. If the Page beforeupdate can be set from meta data then that should work for what I want as I can fill it from my Xcase model.

David