Help - Search - Members - Calendar
Full Version: Require a category
Movable Type Community Forum > Additional Resources > Tips and Tricks
monkeyfromx
Is there any way to require that a category be selected for an entry?
jmevius
I require a category for posts in one of my weblogs. I have this code in Individual Archives:

CODE
<MTIfEmpty var="EntryCategory"><MTDie>You must assign a category to every entry.</MTDie></MTIfEmpty>

It requires the use of the MTIfEmpty and the MTWarnDie plugins. It will create an error message in the rebuild menu.
colburn
Oh, I like this. I'm about to turn over a site to 5 or 6 volunteer editors. A very handy bit of organizing. Thanks!
monkeyfromx
Works great and saved my bacon... Thanks!!
otravers
Nice, however this underlines a usability problem with MT. When you click Back to recover from the error, you're taken back one page, to the post saving attempt, which of course leads you right back to the error message. That's going to drive non-technical users crazy. Does anyone know how to have the Back button go back to the editing page instead? Thanks.
kadyellebee
This sounds like a great way to require other fields in the blog entry; thanks for the idea! I haven't tested out WarnDie; where does the message show up if it fails? If its in the Rebuild window, users don't have a back button in most browsers in that size window anyhow.

Kristine
jmevius
I can't speak for all types of configurations, but I include the WarnDie code in my Individual Archive templates.

Whenver I make a new entry in this blog (if I forget to pick a category) and hit publish, it goes to a Rebuilding Entry Screen (fullsize as opposed to popup) and then spits out the error message as opposed to telling me that the entry was saved.

You're forced to hit the 'Back' button twice (quickly), but it still works. I'm currently integrating it with a series of KeyValues to doublecheck that everything that is required is entered correctly.
wdeer
QUOTE (otravers @ Jan 19 2004, 10:20 PM)
Nice, however this underlines a usability problem with MT. When you click Back to recover from the error, you're taken back one page, to the post saving attempt, which of course leads you right back to the error message. That's going to drive non-technical users crazy. Does anyone know how to have the Back button go back to the editing page instead? Thanks.

ditto

ive been trying to add an alert box telling the poster that they need to go back and add a category

i havent gotten it to work yet... because it will only pop up once a page is fully loaded... and while its rebuilding the page technically isnt fully loaded so it doesnt know to throw the up the alert window

and once the window loads it is finished checking for the empty category field....
noelgreen
Yes, very nice tip!

Just the other day on my MonkeyType.org site I had one of the authors call me and say his icon and name wasn't showing up. I was driving and it took me a minute of "OH GREAT! What now?!" confusion before I realized, "Oh, he didn't select a category..." The thing that tells the site who posted what. smile.gif

Thanks for the tip!! YAY! biggrin.gif
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.