One small step for a man, one giant leap for mankind

Just kidding :-) I was just looking for an eye catcher…

Maybe you have already seen my announcement that I have released v0.17 of the ApexLib Framework, which contains a lot new features.

The previous features in the Framework mostly concentrated on improvements of Oracle APEX on the server, so that’s easier to access Tabular Forms or do automatic validation of date picker or numeric items. The main idea was to make APEX applications more secure without having to do a lot of additional coding. Quoting from Securing Web Applications

The #1 rule that all web developers should never forget is “Don’t trust end-user data!”. With this in mind, when designing html forms it is extremely important to have appropriate server-side validations for every field.

I will probably add more server-side checks on the server, just to make sure.

But my long term goal was always to bring more interactivity to the browser, without having to submit the page. The first step was the AJAX enabled Generic solution for cascading lovs, the next step is now

Out-of-the-box client side validation for required-, date picker- and numeric items

No additional JavaScript code has to be written to do that anymore, it’s automatically generated and done by the ApexLib Framework.

Check out the example page!

What will you see there?

  • Immediate check of a required field as soon as you leave the field. It’s a “soft” check which just shows an inline error message (no ugly alert boxes), informing the user that the field is required.
  • Immediate check of date and number fields if the entered value matches to the defined format mask. It’s a “hard” check, at least on IE the cursor will stay in the field. IE isn’t spec conform here, but in that case it’s good that it isn’t :-)
  • Date and number values are formated according to the format mask. Eg it will fill up the cents with 0 if you only have entered a full dollar amount, or it will add the currency sign (Oracle validation would fail if you don’t enter the currency sign!) and so on.
  • As soon as you correct the error, the error message is removed so that the user gets a visual feedback that the error has been fixed.
  • All the checks are NLS aware, so if your database settings return the Euro sign or use a comma instead of the period for the decimal point, the library will handle that. It should also support all the different date format masks. Also the weird American ones with AM/PM and the month at be beginning… ;-)
  • When the user tries to submit the page, the above checks will be done again. If one of the checks fails the submit is aborted until the user corrects the error.
  • The library is aware of existing onchange/onblur events which are registered for the fields and executes them after its checks.

The rules if a required check is generated are the same as for Automatic required and date picker/format mask check for page items and Plug & play tabular form handling. Please help me finding browser issues (tested with Firefox 2.0 and some basic tests with IE 6.0). I also want to see if the format mask checks I implemented in Javascript work for all the combinations out there. And it the inline error display also works with other themes and userdefined label templates. So readers, please test and give me feedback!

Client Side JavaScript library

Man the JavaScript stuff was a lot of work, you really appreciate the build in TO_DATE and TO_NUMBER and it’s flexibility when you have to implement that by yourself. At least I haven’t found a JavaScript validation toolbox which is compatible with the format mask settings of Oracle.

I’m really new to JavaScript, just started 1 1/2 month ago and I’m currently on page 351 (total 994) of the JavaScript – The Definitive Guilde. So if you look at my code and think, man are you crazy, why you write that much code to do that, it’s a simple regular expression and you are done! Please let me know! I have already done some refactoring of the ApexLib.js library, so that the code is stored in it’s own namespace and I think the new modularization will be quite stable for some time. The structure of the server side packages should also be stable now.

Want to have this client side checks in your application?

Read the “How to integrate” posting I have done. That’s all, the rest is done by the Framework.

Note: It’s build that way that you can also apply it to an existing application. It will just enhance it.

Doesn’t work as expected?

Please read the FAQ on the Automatic required and date picker/format mask check for page items postings for debugging and some basic tests. Still doesn’t work? Send me an e-mail (can be found in my profile) or write an comment.

Roadmap for future development

Next step will be to do the same checks for tabular forms. After that I will try to add some more client side checks. Eg some of the validations which have been defined for the page.

14 thoughts on “One small step for a man, one giant leap for mankind

  1. Patrick,

    Well done! I like the client-side checks very much. I’ll update DG Tournament in the next days with this release.

    Thanks,
    Dimitri

  2. Hi Dimitri,

    wait a few more days so that you also have the checks for the tabular forms. I think it should be ready on Monday.

    I’m still thinking about how to integrate some basic range checks (I think you need them for your score fields). My first thought was to create a package API which can be called in a page process to set the min and max value for an item. But that has the disadvantage that this check can’t be done again on the server (for security) without duplicating the code and write a validation process…

    Any ideas?
    Patrick

  3. I just installed the framework to take advantage of the client-side checks and am having a bit of a problem.

    When I try to use the navigation tabs to move out of the page, it won’t let me because of the Javascript. For some reason, the tabs are doSubmit calls instead of straight up links, so the validation code kicks in.

    Is there an easy work-around for this?

    Otherwise, ApexLib is badass. Thanks!

    Ryan

  4. Hi Ryan,

    write me an e-mail (you can find it in the blog-profile or in the installation instructions). That way it’s easier to communicate.

    Patrick

  5. Hi Patrick,

    Thanks very much for your hard work and giving “THE BEST” to us. It all works fine but it displays error message (inline as well as on top) in black color. Would it possible to display error in red color?

    FYI I am using Theme 20 (Modern Blue).

    Thanks!
    Bhavin

  6. Hi Bhavin,

    that depends on your template. Have a look at your label template definition which CSS classes are used to display the error message. ApexLib is using the same definition than APEX itself when it displays inline error message.

    Patrick

  7. Hi Patrick, your apexlib is very very good. I like especially the case restriction as well as the required field validation.

    One question is that does it work for select list in tabular form ?

    Regards,
    Edward

  8. Hi Edward,

    what should ApexLib do for select lists? Cascading select lists?

    Regards
    Patrick

  9. Hi Patrick,

    Even if I set the column (select list) in a tabular form as ‘required’. It doesn’t fire like individual text,list item. Will the apexlib works in master/details tabular form ?

  10. Hi Patrick,

    Here I need your little help. I have integrated ApexLib framework sometimes last year. Is ApexLib Framework compatible with jQuery 1.3.2 and jQuery-UI 1.7.2 as it is giving me an error, if I used so. If I use 1.2.6 & 1.5.3 does not give any error.

    Please point me to right direction. I wanted to use latest version of jQuery & also existing ApexLib Framework.

    Thanks,
    Bhavin

  11. Hi Patrick,
    Congratulations, great framework! I’m eager to use it on my projects (several applications integrated with EBS R12.0.4) but I’m a little concerned about APEX 4.0. I’ve noticed that some features available on your framework will be released within APEX 4.0, so I would like an advice. Should I wait this release to begin using this features or your framework will integrate seamlessly with it? We have a few projects right now but the portfolio will be huge in the next months. Thanks!

  12. Hi Ygor,

    the ApexLib features will seamlessly integrate with APEX 4.0. I will also provide migration steps/scripts to map the features of ApexLib to the 4.0 replacements.

    Hope that helps
    Patrick

  13. Hi Patrick,

    First of all, this is a great framework. Thank you very much.

    I have a question about this once of the excellent features, client-side validation.

    I wonder if it works for HTML Editor Minimal item. I have one required such item. The validation always reports an error for the item even though it has some text inside.

    If I change the item to a normal textare, it works fine.

  14. Hi,

    (how) can I deactivate client side validation for one page (server side validation shall be activated and is conditional depending on request)?

Comments are closed.