Hi all,

I am trying to customize a simple PHP messsage board by adding a a JS form validator. It works fine on the main board page... but it does not on the pages that are created by the message board when folks submit a post. (Each time someone submits a post, it creates a new HTML file in a subdirectory.... i.e. 1.html, 2.html, etc.)

Here's the original line from the script:

=alertMsg += "  " + fieldDescription[i] + "\n";

Here it is modified by adding the \ before the double quotes:

alertMsg += "  " + fieldDescription[i] + \"\n\";

This causes it to turn up with an actual line break rather than an "\n" ib the resulting file created.

Any ideas on how to make it reproduce the correct code when it creates the new
file?

Here's a bulk of the code:

function createNewFile($name,$mail,$subject,$comments,$count,$date,$other="",$up="0") {
global $settings;
$header=implode('',file("header.txt"));
$footer=implode('',file("footer.txt"));
$content="<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
<head>
<title>RIMEA - $subject by $name</title>
<meta content=\"text/html; charset=windows-1250\">
<link href=\"../java/wwwrimea.css\" type=\"text/css\" rel=\"stylesheet\">
<META HTTP-EQUIV=\"Expires\" CONTENT=\"-1\">
<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">
<script language=\"Javascript\" src=\"../javascript.js\"><!--
//-->
</script>

<SCRIPT language=JavaScript src=\"../../java/milonic_src.js\" type=text/javascript></SCRIPT>	
<script	language=JavaScript>
if(ns4)_d.write(\"<scr\"+\"ipt language=JavaScript src=../../java/mmenuns4.js><\/scr\"+\"ipt>\");		
  else _d.write(\"<scr\"+\"ipt language=JavaScript src=../../java/mmenudom.js><\/scr\"+\"ipt>\"); 
</script>

<SCRIPT language=JavaScript src=\"../../java/menu_data_back2.js\" type=text/javascript></SCRIPT>

</head>

<body background=../images/background.gif'>

<script type=\"text/javascript\" language=\"JavaScript\">
<!--
// Copyright information must stay intact
// FormCheck v1.10
// Copyright NavSurf.com 2002, all rights reserved
// Creative Solutions for JavaScript navigation menus, scrollers and web widgets
// Affordable Services in JavaScript consulting, customization and trouble-shooting
// Visit NavSurf.com at [url]http://navsurf.com[/url]


function formCheck(formobj){
	// name of mandatory fields
	var fieldRequired = Array(\"name\", \"message\");
	// field description to appear in the dialog box
	var fieldDescription = Array(\"Name\", \"Message\");
	// dialog message
	var alertMsg = \"Please fill in the\";

var l_Msg = alertMsg.length;

for (var i = 0; i < fieldRequired.length; i++){
	var obj = formobj.elements[fieldRequired[i]];
	if (obj){
		if (obj.type == null){
			var blnchecked = false;
			for (var j = 0; j < obj.length; j++){
				if (obj[j].checked){
					blnchecked = true;
				}
			}
			if (!blnchecked){
				alertMsg += "  " + fieldDescription[i] + \"\n\";
			}
			continue;
		}

		switch(obj.type){
		case \"select-one\":
			if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == \"\"){
				alertMsg += "  " + fieldDescription[i] + \"\n\";
			}
			break;
		case \"select-multiple\":
			if (obj.selectedIndex == -1){
				alertMsg += "  " + fieldDescription[i] + \"\n\";
			}
			break;
		case \"text\":
		case \"textarea\":
			if (obj.value == \"\" || obj.value == null){
				alertMsg += "  " + fieldDescription[i] + \"\n\";
			}
			break;


		default:
		}
	}
}

if (alertMsg.length == l_Msg){
	return true;
}else{
	alert(alertMsg);
	return false;
}
}
// -->
</script>

Thanks,

~Wayne

    Beautiful! Thank you!

    ~Wayne

      Write a Reply...