MyBB Community Forums

Full Version: how to add in 'select all'?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If I wanted to add in a 'select all' checkbox, where the red square is in this screenshot that would let you, obviously, select all the topics to mass move, or mass delete them.

[Image: checkbox.gif]

how would I do it?

i know i have to edit a template, but which one, and how?
I am brand new to myBB and haven't even viewed any of the code yet, so this may not be perfect, but this seems like a very simple thing you could do with JavaScript.

Add this JavaScript on the page:
<script language="JavaScript" type="text/javascript">
function checkUncheckAll(theElement)
{
	var theForm = theElement.form, z = 0;
	for(z=0; z<theForm.length;z++)
	{
		if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
		{
			theForm[z].checked = theElement.checked;
		}
	}
}
</script>

Now put this code where you want the Select/Deselect all button. It must be inside the same form as all the other ones:
<input type="checkbox" name="checkall" onclick="checkUncheckAll(this);" />

Remember I'm new to myBB so this may not be perfect, but I'm pretty sure it should work. Good luck!