rendered paste body /*************************************************************/
/* Name : Anthony Alves */
/*************************************************************/
function checkForm()
{
var error_message;
var temp_error;
temp_message = surname();
if(temp_message != "")
{
error_message = pageHeader(error_message);
error_message += temp_message;
error_message = pageFooter(error_message);
error_window = window.open("", "errors", 'width=450, height=300');
error_window.document.write(error_message);
error_window.document.close();
}
/*window.open('error.html');*/
return false;
}
function surname()
{
var field01 = document.getElementById('field01');
if(field01.value == "")
return "Must have a surname."
}
function pageHeader(content) {
content = '<?xml version="1.0"encoding="UTF-8" ?>\n';
content += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n';
content += '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';
content += ' <html xmlns="http://www.w3.org/1999/xhtml">\n';
content += ' <head>\n';
content += ' <title>form validation</title>\n';
content += ' </head>\n';
content += ' <body>\n';
content += ' <h3>Please correct the following and resubmit the form</h3>\n';
content += ' <ul>\n';
return content;
}
function pageFooter(content) {
content += ' </ul>\n';
content += ' </body>\n';
content += ' </html>\n';
return content;
}