Validation: I'm not proud of this, but it works

I'm adding validation to the template. Yes, I am aware that this
probably the worst thing to do in the world, but it works, so right now
I'm running with it.