Hi all,

Probably I'm posting a repeated question, but I cannot find my answer...

1 - I'm trying to add articles count in front my categories. Ex:

Category 1 (37)
Sub-Cat 1 (12)
Sub-Cat 2 (25)
Category 2 (18)
Sub-Cat 1 (8)
Sub-Cat 2 (10)

Is there any script or javascript to do this? What changes do I need to make in my php code?

2 - How can I restrict a maximum number of checkboxes selected?

This is my javascript code:

PHP Code:
var max_categories=5;
function 
count(formname)
{
    var 
j=0iel;
    for (
i=0i<formname.elements.lengthi++) {
    
el formname.elements[i];
    if (
el.type=="checkbox" && el.name=="jobtype[{JOBTYPES.id}]" && el.checkedj++;
    }
    if (
j>=max_categories)
        for (
i=0i<formname.elements.lengthi++) 
        {
        
el formname.elements[i]
        if (
el.type=="checkbox" && el.name=="jobtype[{JOBTYPES.id}]" && !el.checked
            
el.disabled true;
         }
    else
        for (
i=0i<formname.elements.lengthi++) 
        
formname.elements[i].disabled false;

and this is the output checkboxes to the categories:

HTML Code:
<input type="checkbox" onClick="count(this.form)" name="jobtype[{JOBTYPES.id}]" value="{JOBTYPES.id}">{JOBTYPES.title}
When I use this, it still could be selected more than 5 categories...

Any help please?

Thanks.