Sorry about that. I really never learned javascript syntax so I just searched on Google for existing code. Here's what I put into edit_entry.tmpl.
Place the following somewhere in the javascript segment of the file:
CODE
function validate() {
var valid = true, output = '';
if (document.MAIN.title.value.length == 0) {
valid = false;
output = 'You cannot leave the title blank.\n';
}
if (document.MAIN.category_id.selectedIndex == 0) {
valid = false;
output += 'Select a category before saving the entry.\n';
}
if (document.MAIN.text.value.length == 0) {
valid = false;
output += 'Type your entry in the Main Entry Text box.';
}
if (!valid)
alert(output);
return valid;
}
It's exactly the same as the code here:
http://developer.irt.org/script/360.htmexcept I changed the variables to match those in MT and I added the check for a non-empty Title textbox.
Now find
CODE
<form name ="MAIN" method="post" action="<TMPL_VAR NAME=SCRIPT_URL>">
and replace it with
CODE
<form name ="MAIN" method="post" action="<TMPL_VAR NAME=SCRIPT_URL>" onSubmit="return validate()">
That's it. I hope I didn't break anything along the way. The code is simple enough for silly ol' me to understand and I think it's all correct. :p