So, I implemented a mechanism on my back end programs to globally monitor for any errors (data decimal, bad dates, etc). I set up a global MONITOR and ON-ERROR I use vvOut_toJsonPair to send back varying SUCCESS responses. Here are some examples of the response messages:
This sounds great so far, but now I need to look for those responses in the front-end code. So, my front end apps typically use a grid, with a tool bar that contains filters for the grid. Each filter uses a data store that is populated from a "proxy" ajax request. So if I have a grid (that uses a store), and 5 filters for the grid (that all use stores), that means I have to monitor for the above messages in 6 different places in the code. On top of that, I created a custom function that makes a standard ajax request to update records from the grid to the database. This "save" function will determine which form field is in error (if any) and will markInvalid that field.
The solution to me is to have 2 different custom functions built to handle ajax responses: a proxy function and a singleton function. Is there a more fluid way to handle this?
Code:
vvOut_toJsonPair('SUCCESS:99,MSG:System is currently down'); ... vvOut_toJsonPair('SUCCESS:PGMERR,MSG:<QMHRCVPM message>');
The solution to me is to have 2 different custom functions built to handle ajax responses: a proxy function and a singleton function. Is there a more fluid way to handle this?
Comment