Código PHP:
   <script language="JavaScript">
function CheckForm () {
    var errorMsg = "";
    //Check for a subject
    if (document.frmAddMessage.subject.value==""){
        errorMsg += "\n\tSubject \t\t- Enter a Subject for your new Topic";
    }
    
    //Check for message
    if (document.frmAddMessage.message.value==""){
        errorMsg += "\n\tMessage \t\t- Enter a Message to post";
    }
    
    //If there is aproblem with the form then display an error
    if (errorMsg != ""){
        msg = "_______________________________________________________________\n\n";
        msg += "The form has not been submitted because there are problem(s) with the form.\n";
        msg += "Please correct the problem(s) and re-submit the form.\n";
        msg += "_______________________________________________________________\n\n";
        msg += "The following field(s) need to be corrected: -\n";
        
        errorMsg += alert(msg + errorMsg + "\n\n");
        return false;
    }
    
    //Reset the submition page back to it's original place
    document.frmAddMessage.action = "post_message.asp"
    document.frmAddMessage.target = "_self";
 
    frmAddMessage.Submit.disabled=true;
    
    return true;
}
</script> 
   Código HTML:
 <form method="post" name="frmAddMessage" action="post_message.asp=" onSubmit="return CheckForm();" onReset="return ResetForm();"> ASUNTO<INPUT TYPE="text" NAME="subject" size="70"> <IFRAME src="editor.asp?" width="100%" height="390" frameborder="no" scrolling="no" id="message"></IFRAME> <input type="hidden" name="message" value=""> <input type="submit" name="Submit" value="Post New Topic" OnClick="document.frmAddMessage.message.value = frames.message.document.contenido.value;" tabindex="30" /> </form>
 
 


