Friday, July 25, 2008

Selecting Apex page items by class using $x_ByClass

I just noticed an $x_ByClass example on Carl Backstrom's demo site which selects page items using the class attribute.

So why is this important?

It provides you with a mechanism to easily tag form items, typically text input fields, so you can add AJAX functionality to them.
In Carl's demo he is simply changing the the border color of datepicker items, as a proof of concept. This is exactly the same technique I use with ExtJS to:
All I have to do is assign a class to a field, and generic javascript code fires looking for the class and applying the functionality. What's really great is Oracle is building this javascript infrastructure directly into Apex.

It means that developers can easily hook in widgets and AJAX functionality, because the low level plumbing has been done for us.