$('input:checkbox:checked').map(function() { return $(this).val(); }).get().join(';');And the complete Dynamic Action to see the settings that I used: Probably there is an even easier way to get the same results, I'd be more than interested to learn that...
26 October 2011
Using jQuery to determine the checked items
In one of my APEX pages, I needed to know in javascript which checkboxes are checked. The checked values are placed in an item as a semi-colon (;) delimited list. To be able to do this I created a Dynamic Action which was quite easy.. what wasn't that easy (at least for me, and that's why I want to keep it here so the next time I need this) was to write the javascript expression to get the values.
jQuery is simply amazing. Using a "simple" expression it is "easy" to get exactly what was needed.
Subscribe to:
Post Comments (Atom)
Hi Alex,
ReplyDeletein the case you don't want to examine all checkbox page item on the page you can also use
$v2('P10_DEPTNO').join(';')
or
$v('P10_DEPTNO')
which will return all the checked values of that page item. $v2 returns an array and $v returns a colon separated string. That might be simpler that the jQuery expression.
Regards
Patrick
Hi Patrick,
ReplyDeleteI know I underutilize all the built-in javascript goodness, have to study more.
Thank you for this addition,
Alex