- var basedon = document.getElementById('<% $NamePrefix . $CustomField->BasedOnObj->id %>-Values');
- if (basedon != null) {
- var oldchange = basedon.onchange;
- basedon.onchange = function () {
- filter_cascade(
- '<% $id %>-Values',
- basedon.value,
- 1
+ var basedon = jQuery('[name^="'+<% $BasedOnName || $NamePrefix . $CustomField->BasedOnObj->id . '-Value' |n,j %>+'"][type!="hidden"]:input:not(.hidden)');
+ basedon.each( function() {
+ var oldchange = jQuery(this).onchange;
+ jQuery(this).change( function () {
+ var vals;
+ if ( jQuery(this).is('select') ) {
+ vals = basedon.first().val();
+ }
+ else {
+ vals = [];
+ jQuery(basedon).each( function() {
+ if ( jQuery(this).is(':checked') ) {
+ vals.push(jQuery(this).val());
+ }
+ });
+ }
+ filter_cascade_by_id(
+ <% $name |n,j%>,
+ vals,
+ true