Using a procedure to save form changes and displaying feedback

Problem


The processing that I want to do on form change is a little more complex than just inserting or updating the rows, so I want to use a procedure. Moreover, I want to display a custom message like "User Created", "User Updated", or "Error..."

Solution


I started with a simple form based on a table then made the following changes:

Find the process that manages the table handling.




Change the type of the procedure to "PL/SQL Code".


Put your code in:

The example above is over simplified, but I was just testing what it would look like.
You call a procedure with your parameters to do the processing, the you should have a branch based on the result to display the type of message you want. I have two types:

Good:
apex_application.g_print_success_message := '<span style="color:green">Computer created</span>';
Bad:
apex_application.g_print_success_message := '<span style="color:red">No valid computer name</span>';

The next thing you want to do is clear the defaulting processing messages.




The result looks like this:

Bad:

Good:

You can play around with the colors and styles, the below post goes into more detail.

Acknowledgements

http://www.apex-at-work.com/2009/01/using-individual-errorsuccess-messages.html





Comments