
// SPECIAL CHARACTER VALIDATION

// 1. BELOW ARE REQUIRED GLOBAL VARIABLES THAT MUST BE IN THE DOCUMENT THIS VALIDATION SCRIPT IS ADDED TO
// 2. REPLACE VARIALBE fn1 VALUE WITH THE CORRECT FORM NAME FROM THE DOCUMENT THIS SCRIPT IS ADDED TO
// var error = 0 ; var errortext = "ERROR \n" ; var fn1 = 'form1' ;

function specialchar1(fn1,fe1,del) {	
	var specval1 = /['"|]/gi ;
	var path = document[fn1][fe1] ;
	var fe1hist = path.value	
	if(specval1.test(path.value))
		{ 
			if(del == "delete")
			{
				alert("ERROR\n This field contains characters that are not allowed, please only use letters, numbers and following characters \_ \/ \\ \. \:\n   The Illegal characters will be deleted") ;
				fe1hist = fe1hist.replace(specval1,"") ;	
			}
			else
			{
				alert("ERROR\n This field contains characters that are not allowed, please only use letters, numbers and following characters \_ \/ \\ \. \:\n") ;
			}
			
			path.value = fe1hist ; path.focus() ;
		}
}

// Sample of activation code for text field validation
// onblur="specialchar1('form1','formelementname','TEXT FIELD NAME')"

function specialchar2(fn1,fe1,fen) {
	var specval1 = /['"|]/ ; var path = document[fn1][fe1] ;
	if(specval1.test(path.value))
	{ alert('ERROR\n'+fen+" file field contains characters that are not allowed, please only use letters, numbers and the following characters \_ \/ \\ \. \:\n") ; path.focus() ; }
}

// Sample of activation code for text field validation
// onchange="specialchar2('form1','formelementname','FILE FIELD NAME')"

//----------END
	
function specialcharsub1(fn1,fe1,fen) {
	var specval1 = /['"|]/  ; var path = document[fn1][fe1] ;
	if(specval1.test(path.value))
	{ errortext += fen+" field contains characters that are not allowed, please only use letters, numbers and the following characters \_ \/ \\ \. \:\n" ; error = 1 ; }
}

// Sample of activation code for text field validation
// specialcharsub1('form1','txt1','TEXT Field 1') ;

//----------END

function specialcharsub2(fn1,fe1,fen) {
	var specval1 = /['"|]/  ; var path = document[fn1][fe1] ;
	if(specval1.test(path.value))
	{ errortext += fen+" file field contains characters that are not allowed, please only use letters, numbers and the following characters \_ \/ \\ \. \:\n" ; error = 1 ; }
}

// Sample of activation code for text field validation
// specialcharsub1('form1','txt1','FILE Field 1') ;

//----------END