2 Filter
Misco opened this issue · 2 comments
as far as I now, there is no limit on the categories the user can select, you cannot fors them to select one of each parent category. You can only train them (and hope they follow the guide 🙈 ).
`var ele = $('#pub .mod_newscategories_cumulativehierarchical');
ele.find('select').on('change', function(e){
e.preventDefault();
function removeFirstHfId(href) {
let match;
const firstHfMatch = href.match(/hf-/g);
if (firstHfMatch && firstHfMatch.length >= 2) {
href = href.replace(/hf-[^_]+/, '');
}
const firstIdMatch = href.match(/id-/g);
if (firstIdMatch && firstIdMatch.length >= 2) {
href = href.replace(/id-[^_]+/, '');
}
return href;
}
window.location = removeFirstHfId($(this).val());
});`
Dieser Javascript Code erreicht das gewünschte Verhalten.