Help - Search - Members - Calendar
Full Version: Making Categories And/or Tags Required?
Movable Type Community Forum > Using Movable Type > Categories and Entry Tags
Matthew Schaefer
I have inherited several Movable Type blogs that have been up and running for a while. As I acclimate to the new environments, I have found that the users blogging on my system are only entering categories and tags haphazardly. Some are diligent and others never categorize or tag their posts, making my sites' organization spotty. Can someone tell me how to enforce the use of categories and tags when users create a new post? I would like it not to be an option, but rather to have an error thrown. Thanks!
mccreath
I don't know of a way in MT to make them required (although there probably is one), but you could use a little JavaScript form validator to verify whether any categories have been selected or any tags have been entered. Or you could use JavaScript to disable the "Save" button until either a category is selected or a tag is entered.

Which version of MT are you using?
Matthew Schaefer
Thanks for the reply!

I'm using MT 4.01 with Enterprise Pack 1.0. So, if I implement some Javascript for validation before submission of an entry, my next question is: where do I put that Javascript? I've been unable to find how one can modify the content submsission forms...

I think that this form of validation would be sufficient for our needs.

So, is there a straightforward way to modify the submission forms?

Thanks!
Matthew Schaefer

QUOTE (mccreath @ Jul 24 2008, 08:27 PM) *
I don't know of a way in MT to make them required (although there probably is one), but you could use a little JavaScript form validator to verify whether any categories have been selected or any tags have been entered. Or you could use JavaScript to disable the "Save" button until either a category is selected or a tag is entered.

Which version of MT are you using?

mccreath
QUOTE (Matthew Schaefer @ Jul 25 2008, 10:11 AM) *
I'm using MT 4.01 with Enterprise Pack 1.0. So, if I implement some Javascript for validation before submission of an entry, my next question is: where do I put that Javascript? I've been unable to find how one can modify the content submsission forms...


I'd probably add the functionality to one of the existing JavaScript files in the mt-static directory that gets loaded on the Entry form (maybe edit "edit.js"). That way if something significant changes in the base templates that create the admin interface, you won't have to backtrack.

The form elements that you'll want to check should be pretty easily accessible through the DOM. The "Tags" field has an ID of "tags", so that's a no-brainer. The category checkboxes might be a little bit trickier, depending on how you approach it, but each of the checkboxes does have a class of "add-category-checkbox", so you could grab that array and make sure that at least one of them is checked.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.