' VBScript source code

function spchar_validation(tbox,obj,cond)
		' Generic Condition
		obj = "Invalid input in "+obj+" : "
		spchar_validation = false
		
		if (ucase(cond)="ALL") then
			Set RgExpObj = New RegExp
			'RgExpObj.Pattern="--|;|%|'|<|>|<OBJECT>|$DATA|xp_"
			RgExpObj.Pattern="""|--|=|;|%|'|<|>|<OBJECT>|\||@|&|\$|\$DATA|\||xp_|\\'|\+|\\"
			RgExpObj.IgnoreCase=true
			RgExpObj.Global=true
			if(trim(tbox) <> "") then
				if RgExpObj.Test(tbox) then
					MsgBox obj + "Invalid data input.Special characters like --,;,%,',<,> etc are not allowed.",vbOKOnly,"Notification"
					spchar_validation = false
					exit function
				end if
			end if
		end if
		if (ucase(cond)="Email") then
			Set RgExpObj = New RegExp
			'RgExpObj.Pattern="--|;|%|'|<|>|<OBJECT>|$DATA|xp_"
			RgExpObj.Pattern="""|--|=|;|%|'|<|>|<OBJECT>|\|&|\$|\$DATA|\||xp_|\\'|\+|\\"
			RgExpObj.IgnoreCase=true
			RgExpObj.Global=true
			if(trim(tbox) <> "") then
				if RgExpObj.Test(tbox) then
					MsgBox obj + "Invalid data input.Special characters like --,;,%,',<,> etc are not allowed.",vbOKOnly,"Notification"
					spchar_validation = false
					exit function
				end if
			end if
		end if
		
		if (ucase(cond)="INT") then
			Set RgExpObj = New RegExp
			RgExpObj.Pattern="[^0-9]"
			RgExpObj.IgnoreCase=true
			RgExpObj.Global=true
			if(trim(tbox) <> "") then
				if RgExpObj.Test(tbox) then
					MsgBox obj + "Invalid data input.Only Numbers are allowed.",vbOKOnly,"Notification"
					'chkChar = "Please enter a valid numeric number."
					exit function
				end if
			end if
		end if
		
		spchar_validation = true
	end function
