May 132012
 

Example below:

<SCRIPT LANGUAGE="JavaScript">
  function validateForm(formName, fieldName, alertText) {
    var x=document.forms[formName][fieldName].value;
    if (x==null || x=="") {
      alert(alertText);
      return false;
    }
  }
</SCRIPT>

And the form tag would something like this:

<form name="formName" method="POST" action="index.php" 
      onsubmit="return validateForm('newBlock', 'newTitle', 'alertText')">
 Posted by at 12:01 am