Thursday, 6 September 2012

Using jQuery selector in APEX

The more I extend my development repertoire in APEX, the more I feel like I'm becoming a web developer as well as an Oracle technologist.

I'm still expanding my understanding on the use of jQuery, but every day I feel happier about it and see what such an amazing tool it is to extend APEX applications.

I little example today was to create a dynamic action that fires every time a checkbox on my page is changed. I wanted to do this to show a warning if no checkboxes were ticked, and I didn't want to hardcode checkbox names - so the ideal solution is to use the jQuery Selector selection type.

By using the syntax
'input:checkbox'
this dynamic action will fire as required. Further information this selector (and others) can be found in the jQuery documentation. They main thing to note for APEX is that surrounding $() is not required in this context - otherwise you receive the error
Uncaught Syntax error, unrecognized expression: $('input:checkbox')

And as a starting point if you're unfamiliar with jQuery, check out the FAQ.

I also picked up this handy e-book for $5 during an O'Reilly promotion: jQuery Pocket Reference

2 comments:

Roel Hartman said...

and you can even (or better) do without the quotes...

Scott Wesley said...

True indeed. Not sure why I left them in...