Templating: added validation to template editor for variable names, Fixes #1133