dgielis_

Archive · 28 December 2006

DG Tournament updated with PW-Error Handling

Written 20 years ago. Oracle APEX has moved on a lot since; check the current Oracle APEX posts too.

Patrick Wolf and I exchanged some mails in the last weeks. I promised him to test his “ApexLib Framework” in my application.

As you can see on the picture, the package is integrated and works nicely. Patrick explains well how to integrate the package on his blog. I didn’t follow the steps exactly like he wrote, for ex. I didn’t make a region on page 0, but integrated a part in my template and a part in the page where I wanted to use the advanced error handling package. I also saved the javascript file as a static file in APEX.

You can’t see this package working in DG Tournament for real, as I implemented this error-handling in the editor/admin part of the application. I didn’t choose to implement it in the “Your Bets” page as I use (client side) javascript in that page to avoid “human”-errors. For ex. you can only type numbers in the score fields, so I don’t need to check if a number was entered (and I avoid a round-trip to the server). But the picture shows you a nice error.

The ApexLib package is good, it shows very nicely what you can do and how you can improve APEX, but there’s still room for improvement:

- check also if there’s a number as value (now if you type ‘A’ the error isn’t “right”)

- more client-side scripting instead of server-side round-trips (but that also counts for APEX in general)

The page validation I used:

DECLARE vMin NUMBER(3) := 0; vMax NUMBER(3) := 99;BEGIN FOR i IN 1 .. ApexLib_TabForm.getRowCount LOOP  IF ApexLib_TabForm.hasRowChanged(i)  THEN   IF ApexLib_TabForm.NV('HOME_SCORE', i) NOT BETWEEN vMin AND vMax   THEN    ApexLib_Error.addError   ( pError => 'The score of the home team has to be a number between %0 and %1'   , pColumnName => 'HOME_SCORE'   , pRow => i   , p0 => vMin   , p1 => vMax   );   END IF;   IF ApexLib_TabForm.NV('VISIT_SCORE', i) NOT BETWEEN vMin AND vMax   THEN    ApexLib_Error.addError   ( pError => 'The score of the visit team has to be a number between %0 and %1'   , pColumnName => 'VISIT_SCORE'   , pRow => i   , p0 => vMin   , p1 => vMax   );   END IF;  END IF; END LOOP; RETURN ApexLib_Error.getErrorStack;END;

_

* Update 30-Dec:

If you specify a format mask for your text field, the error is as expected. In my case I had to specify for HOME_SCORE and VISIT_SCORE format mask 90._

Originally published on Blogspot.

Comments

Comments appear after I've read them. Plain text; line breaks are kept. Privacy