KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/efusion1/dwzValidator/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/efusion1/dwzValidator/dwzValidatorClass.asp
<%
'**********************************
' http://www.DwZone-it.com
' Server Side Form Validator
' Copyright (c) DwZone.it 2000-2005
'**********************************
class dwzServerSideValidator
	
	Private MainMessage
	Private FormName
	Private CodeBefore
	Private CodeAfter
	Private ClassName
	Private sIsValid
	Private ImageError
	Private sReturnMethod
	Private JsAlert
	Private FormSendMethod
	Private RedirectPage
	Private RedirectMethod
	
	Private ItemFieldName()
	Private ItemFieldType()
	Private ItemRequired()
	Private ItemValidate()
	Private ItemFieldLength()
	Private ItemErrorMessage()
	Private ItemValid()
	
	Private ItemCount
	
	Public isPostBack
	Public isReturnBack
		
		
	public sub SetRedirect(param_1, param_2)
		RedirectPage = param_1
		RedirectMethod = param_2
	end sub
	
	public sub SetMainMessage(param)
		MainMessage = param
	end sub
	
	public sub SetFormName(param)
		FormName = param
	end sub
	
	public sub SetCodeBefore(param)
		CodeBefore = param
	end sub
	
	public sub SetCodeAfter(param)
		CodeAfter = param
	end sub
	
	public sub setImageError(param)
		ImageError = param
	end sub
	
	public sub SetClassName(param)
		ClassName = param
	end sub
		
	public sub SetReturnMethod(param)
		sReturnMethod = Ucase(param)
	end sub
	
	public sub SetJsAlert(param)
		JsAlert = param
	end sub
	
	Public sub add(sFieldName, sFieldType, sRequired, sValidate, sFieldLength, sErrMessage)
		ItemCount = ItemCount + 1
		ReDim Preserve ItemFieldName(ItemCount)
		ReDim Preserve ItemFieldType(ItemCount)
		ReDim Preserve ItemRequired(ItemCount)
		ReDim Preserve ItemValidate(ItemCount)
		ReDim Preserve ItemFieldLength(ItemCount)
		ReDim Preserve ItemErrorMessage(ItemCount)
		ReDim Preserve ItemValid(ItemCount)
		
		ItemFieldName(ItemCount) = sFieldName
		ItemFieldType(ItemCount) = sFieldType
		ItemRequired(ItemCount) = sRequired
		ItemValidate(ItemCount) = sValidate
		ItemFieldLength(ItemCount) = sFieldLength
		ItemErrorMessage(ItemCount) = sErrMessage
		ItemValid(ItemCount) = true
	end sub
	
	
	Private Sub Class_Initialize()
	End Sub
	
	Private Sub Class_Terminate()
	End Sub
		
	Public Sub Init ()
		
		CT = Request.ServerVariables("HTTP_Content_Type") 
		if len(CT) = 0 then CT = Request.ServerVariables("CONTENT_TYPE") 
	  	If LCase(Left(CT, 19)) = "multipart/form-data" Then 
			response.Clear()
			response.write("WARNING!!<br>")
			response.write("http://www.dwzone-ir.com<br>")
			response.write("The Server Side Form Validtaion is not compatible width the enctype of the form<br>")
			response.write("If this is an upload page use a different form validator method<br>")
			response.End()
			Exit sub
		End If 
		
		ItemCount = -1
		if request("dwzServerValidate")<>"" and lcase(request("dwzServerValidate")) = lcase(FormName) then
			isPostBack = true
		else
			isPostBack = false
		end if
		sIsValid = true
		if request("dvzValidateBack")<>"" then
			isReturnBack = true
		else
			isReturnBack = false
		end if
		
		FormSendMethod = UCase(Request.ServerVariables("REQUEST_METHOD"))
		
	End Sub	
	
	Public Sub Validate()
		
		if request("dvzValidateBack")<>"" then
			RecreateValidation()
			exit sub
		end if
		
		if not isPostBack then
			exit sub
		end if
		
		if lcase(Request.ServerVariables("HTTP_Content_Type")) = "multipart/form-data" then
			response.Clear()
			msg = "WARNING!!<BR>"
			msg = msg & "The form ENCTYPE is setup to multipart/form-data<BR>"
			msg = msg & "This Form Validator don't work with this ENCTYPE<br>"
			msg = msg & "Please remove the ENCTYPE before use this validator<br>"
			response.write(msg)
			response.End()
		end if
		
		for K=0 to ItemCount
			select case lcase(ItemFieldType(K))
			case "textarea"
				ValidateTextArea(K)
			case "checkbox"
				ValidateCheckBox(K)
			case "chk group"
				ValidateChkGroup(K)
			case "radio"
				ValidateRadio(K)
			case "select"
				ValidateSelect(K)
			case else
				ValidateText(K)
			end select
		next
		
		sIsValid = true
		for J=0 to ItemCount
			if not ItemValid(J) then
				sIsValid = false
				exit for
			end if
		next
		
		if not sIsValid then
			ReturnBack()
		else
			if RedirectPage<>"" then
				if RedirectMethod="0" then
					response.Redirect(RedirectPage)
				elseif RedirectMethod="1" then
					RedirectWithPost()
				else
					server.Transfer(RedirectPage)
				end if
				response.End()
			end if
		end if
	end sub
	
	public function getSummary()
		dim retStr
		retStr = ""
		if not sIsValid then
			for J=0 to ItemCount
				if not ItemValid(J) then
					tmp = CodeBefore & ItemErrorMessage(J) & CodeAfter
					if ClassName <> "" then
						tmp = "<div class='" & ClassName & "'>" & tmp & "</div>"
					else
						tmp = tmp & "<br>"
					end if
					retStr = retStr & tmp
				end if
			next
			if retStr <> "" then
				tmp = CodeBefore & MainMessage & CodeAfter
				if ClassName <> "" then
					tmp = "<div class='" & ClassName & "'>" & tmp & "</div>"
				else
					tmp = tmp & "<br><br>"
				end if
				retStr = tmp & retStr
			end if
		end if
		response.write(retStr)
	end function
	
	public function getMainMessage()
		dim retStr
		retStr = ""
		if not sIsValid then
			tmp = CodeBefore & MainMessage & CodeAfter
			if ClassName <> "" then
				tmp = "<div class='" & ClassName & "'>" & tmp & "</div>"
			else
				tmp = tmp & "<br><br>"
			end if
			retStr = tmp & retStr
		end if
		response.write(retStr)
	end function
	
	public function getJsAlert()
		dim retStr
		retStr = ""
		if JsAlert <> "N" then
			for J=0 to ItemCount
				if not ItemValid(J) then
					retStr = retStr & replaceForJs(ItemErrorMessage(J)) & "\n"
				end if
			next
			if retStr <> "" then
				retStr = "<script language=javascript>alert('" & replaceForJs(MainMessage) & "\n\n" & retStr & "')</script>"
			end if
		end if
		getJsAlert = retStr
	end function
	
	private function replaceForJs(str)
		replaceForJs = replace(replace(str,chr(34),"''"),"'","\u0027")
	end function
	
	public function getTextErrMsg(fldName)
		dim retStr
		id = getIndex(fldName)
		retStr = "&nbsp;"
		if id <> -1 then
			if not ItemValid(id) then
				retStr = CodeBefore & ItemErrorMessage(id) & CodeAfter
				if ClassName <> "" then
					retStr = "<div class='" & ClassName & "'>" & retStr & "</div>"
				end if
			end if
		end if
		response.write(retStr)
	end function
	
	public function getImageErrMsg(fldName)	
		dim retStr	
		id = getIndex(fldName)
		retStr = "&nbsp;"
		if id <> -1 then
			if not ItemValid(id) then
				retStr = "<img src='" & ImageError & "' border='0' alt='" & replace(replace(ItemErrorMessage(id),"'",""),chr(34),"") & "' />"
			end if
		end if
		response.write(retStr)
	end function
	
	private function getIndex(fld)
		dim retStr
		retStr = -1
		for J=0 to ItemCount
			if lcase(ItemFieldName(J)) = lcase(fld) then
				retStr = J
				exit for
			end if
		next
		getIndex = retStr
	end function
	
	private sub RecreateValidation()
		if request("dvzValidateResult")="" then
			exit sub
		end if
		tmp = split(request("dvzValidateResult"),"@_dwz_@")
		for J=0 to ubound(tmp)
			for K=0 to ItemCount
				if lcase(ItemFieldName(K)) = lcase(tmp(J)) then
					'response.write K
					'response.End()
					ItemValid(K) = false
					sIsValid = false
					exit for
				end if
			next
		next
	end sub
	
	
	private sub RedirectWithPost()
		response.Clear()
		response.write("<html><body>" & vbcrlf)
		response.write("<form style='visibility:hidden' name='dwzForm' id='dwzForm' method='POST' action='" & RedirectPage & "' >" & vbcrlf)
		if FormSendMethod = "POST" then
			for each Key in request.Form
				if lcase(Key)<>lcase("dwzServerValidate") and lcase(Key)<>lcase("dvzValidateBack") and left(lcase(Key),3)<>"mm_" and lcase(Key)<>lcase("dvzValidateResult") then
					response.write("<TEXTAREA id='" & Key & "' name='" & Key & "' >" & request(Key) & "</TEXTAREA>" & vbcrlf)
				end if
			next
		else
			for each Key in request.QueryString
				if lcase(Key)<>lcase("dwzServerValidate") and lcase(Key)<>lcase("dvzValidateBack") and left(lcase(Key),3)<>"mm_" and lcase(Key)<>lcase("dvzValidateResult") then
					response.write("<TEXTAREA id='" & Key & "' name='" & Key & "' >" & request(Key) & "</TEXTAREA>" & vbcrlf)
				end if
			next
		end if
		response.write("</form>" & vbcrlf)
		response.write("<script language=javascript>document.getElementById('dwzForm').submit()</script>" & vbcrlf)
		response.write("</body></html>")
		response.End()		
	end sub
	
	
	
	private sub ReturnBack()
		if sReturnMethod <> "POST" and sReturnMethod <> "GET" then
			exit sub
		end if
		response.Clear()
		response.write("<html><body>" & vbcrlf)
		FormTag = "<form style='visibility:hidden' name='dwzForm' id='dwzForm' method='" & sReturnMethod & "' action='" & CStr(Request.ServerVariables("SCRIPT_NAME"))
		if FormSendMethod = "POST" then
			if request.QueryString<>"" then
				FormTag = FormTag & "?" & request.QueryString
			end if
		end if
		FormTag = FormTag & "' >" & vbcrlf
		response.write(FormTag)
		if FormSendMethod = "POST" then
			for each Key in request.Form
				if lcase(key)<>lcase("DW_Form_Name") and lcase(Key)<>lcase("dwzServerValidate") and lcase(Key)<>lcase("dvzValidateBack") and left(lcase(Key),3)<>"mm_" and lcase(Key)<>lcase("dvzValidateResult") then
					response.write("<TEXTAREA id='dwzValidate_" & Key & "' name='dwzValidate_" & Key & "' >" & request(Key) & "</TEXTAREA>" & vbcrlf)
				end if
			next
		else
			for each Key in request.QueryString
				if lcase(key)<>lcase("DW_Form_Name") and lcase(Key)<>lcase("dwzServerValidate") and lcase(Key)<>lcase("dvzValidateBack") and left(lcase(Key),3)<>"mm_" and lcase(Key)<>lcase("dvzValidateResult") then
					response.write("<TEXTAREA id='" & Key & "' name='" & Key & "' >" & request(Key) & "</TEXTAREA>" & vbcrlf)
				end if
			next
		end if
		response.write("<INPUT type='hidden' id='dvzValidateResult' name='dvzValidateResult' value='" & getValidateResult() & "' />" & vbcrlf)
		response.write("<INPUT type='hidden' id='dvzValidateBack' name='dvzValidateBack' value='1' />" & vbcrlf)
		response.write("</form>" & vbcrlf)
		response.write("<script language=javascript>document.getElementById('dwzForm').submit()</script>" & vbcrlf)
		response.write("</body></html>")
		response.End()
	end sub
	
	Public Function isValid()
		isValid = sIsValid
	end function
	
	Public Function showRegion(formName,boolValue)
		if isPostBack or isReturnBack then
			select case boolValue
			case "0"
				if isValid() then
					showRegion = false
				else
					showRegion = true
				end if
			case else
				if isValid() then
					showRegion = true
				else
					showRegion = false
				end if
			end select
		else
			showRegion = false
		end if
	end function
		
	Private Function getValidateResult()
		dim retStr
		retStr = ""
		cong = ""
		for J=0 to ItemCount
			if not ItemValid(J) then
				retStr = retStr & cong & ItemFieldName(J)
				cong = "@_dwz_@"
			end if
		next
		getValidateResult = retStr
	end function
	
	
	private function ValidateText(index)
		if ItemRequired(index)="Yes" and left(ItemValidate(index),11)<>"One of them" then
			if request(ItemFieldName(index)) = "" then
				ItemValid(index) = false
				exit function
			end if
		end if
		fldValue = request(ItemFieldName(index))
		if ItemFieldLength(index) <> "," and ItemFieldLength(index) <> "" then
			tmp = split(ItemFieldLength(index), ",")
			if tmp(0)<>"" and isNumeric(tmp(0)) then
				if len(fldValue) < clng(tmp(0)) then
					ItemValid(index) = false
					exit function
				end if
			end if
			if tmp(1)<>"" and isNumeric(tmp(1)) then
				if len(fldValue) > clng(tmp(1)) then
					ItemValid(index) = false
					exit function
				end if
			end if
		end if
		
		Set RegEx = New RegExp 
		RegEx.Global = True 
		RegEx.IgnoreCase = True 
		
		if fldValue = "" then
			ItemValid(index) = true
			exit function
		end if
		
		if ItemValidate(index) = "Alphanumeric" then
			RegEx.Pattern = "^[A-Za-z 0-9]*$"
			if not RegEx.test(fldValue) then
				ItemValid(index) = false
				exit function
			end if
		
		elseif ItemValidate(index) = "Alphabetic" then
			RegEx.Pattern = "^[A-Z a-z]*$"
			if not RegEx.test(fldValue) then
				ItemValid(index) = false
				exit function
			end if
			
		elseif left(ItemValidate(index),7) = "Integer" then
			RegEx.Pattern = "^-?[0-9]*$"
			if not RegEx.test(fldValue) then
				ItemValid(index) = false
				exit function
			end if
			tmp = split(ItemValidate(index) ,",")
			if tmp(1)<>"" and isNumeric(tmp(1)) then
				if clng(tmp(1)) > clng(fldValue) then
					ItemValid(index) = false
					exit function
				end if
			end if
			if tmp(2)<>"" and isNumeric(tmp(2)) then
				if clng(tmp(2)) < clng(fldValue) then
					ItemValid(index) = false
					exit function
				end if
			end if
			
		elseif left(ItemValidate(index),5) = "Float" then
			RegEx.Pattern = "^-?[0-9]+[\.]*[0-9]*$"
			if not RegEx.test(fldValue) then
				ItemValid(index) = false
				exit function
			end if
			tmp = split(ItemValidate(index) ,",")
			if tmp(1)<>"" and isNumeric(tmp(1)) then
				if cdbl(tmp(1)) > cdbl(replace(fldValue,".",",")) then
					ItemValid(index) = false
					exit function
				end if
			end if
			if tmp(2)<>"" and isNumeric(tmp(2)) then
				if cdbl(tmp(2)) < cdbl(replace(fldValue,".",",")) then
					ItemValid(index) = false
					exit function
				end if
			end if
		
		elseif left(ItemValidate(index),10) = "AcceptChar" then
			tmp_1 = mid(ItemValidate(index), instr(ItemValidate(index), ",") + 1)
			RegEx.Pattern = "^[" & tmp_1 & "]*$"
			if not RegEx.test(fldValue) then
				ItemValid(index) = false
				exit function
			end if
			
		elseif left(ItemValidate(index),12) = "unAcceptChar" then
			tmp_1 = mid(ItemValidate(index), instr(ItemValidate(index), ",") + 1)
			RegEx.Pattern = "^[^" & tmp_1 & "]*$"
			if not RegEx.test(fldValue) then
				ItemValid(index) = false
				exit function
			end if
			
		elseif left(ItemValidate(index),6) = "RegExp" then
			pos_1 = instr(ItemValidate(index),",")
			pos_2 = instrRev(ItemValidate(index),",")
			pattern = mid(ItemValidate(index), pos_1+1, pos_2-pos_1-1)
			flag = mid(ItemValidate(index), pos_2+1)
			RegEx.Global = false
			RegEx.IgnoreCase = false 
			'"g","i","gi","g-rev","i-rev","gi-rev","rev"
			select case flag
			case "g", "g-rev"
				RegEx.Global = true
			case "i","i-rev"
				RegEx.IgnoreCase = true
			case "gi", "gi-rev", "rev"
				RegEx.Global = true
				RegEx.IgnoreCase = true
			end select
			RegEx.Pattern = pattern
			if not RegEx.test(fldValue) then
				ItemValid(index) = false
				exit function
			end if
			
		elseif ItemValidate(index) = "Mail" then
			RegEx.Pattern = "^[\w\.=-]+@[\w\.-]+\.[a-z]{2,4}$"
			if not RegEx.test(fldValue) then
				ItemValid(index) = false
				exit function
			end if
			
		elseif left(ItemValidate(index),4) = "Date" then
			tmp = split(ItemValidate(index) ,",")
			dateFormat = tmp(1)
			select case dateFormat
			case "DD.MM.YYYY", "DD/MM/YYYY", "DD-MM-YYYY"
				myDate = split(fldValue, mid(dateFormat,3,1))
				if ubound(myDate) <> 2 then
					ItemValid(index) = false
					exit function
				end if
				if not isNumeric(myDate(0)) or not isNumeric(myDate(1)) or not isNumeric(myDate(2)) then
					ItemValid(index) = false
					exit function
				end if
				myDay = myDate(0)
				myMonth = myDate(1)
				myYear = myDate(2)
				
			case "MM.DD.YYYY", "MM/DD/YYYY", "MM-DD-YYYY":
				myDate = split(fldValue, mid(dateFormat,3,1))
				if ubound(myDate) <> 2 then
					ItemValid(index) = false
					exit function
				end if
				if not isNumeric(myDate(0)) or not isNumeric(myDate(1)) or not isNumeric(myDate(2)) then
					ItemValid(index) = false
					exit function
				end if
				myDay = myDate(1)
				myMonth = myDate(0)
				myYear = myDate(2)
				
			case "YYYY-MM-DD", "YYYY/MM/DD", "YYYY.MM.DD"
				myDate = split(fldValue, mid(dateFormat,5,1))
				if ubound(myDate) <> 2 then
					ItemValid(index) = false
					exit function
				end if
				if not isNumeric(myDate(0)) or not isNumeric(myDate(1)) or not isNumeric(myDate(2)) then
					ItemValid(index) = false
					exit function
				end if
				myDay = myDate(2)
				myMonth = myDate(1)
				myYear = myDate(0)
				
			end select
			'DateSerial(Year, Month, Day)
			newDate = DateSerial(myYear,myMonth,myDay)
			if clng(Year(newDate))<>clng(myYear) or clng(month(newDate))<>clng(myMonth) or clng(day(newDate))<>clng(myDay) then
				ItemValid(index) = false
				exit function				
			end if
			
		elseif left(ItemValidate(index),4) = "Time" then
			tmp = split(ItemValidate(index) ,",")
			select case tmp(1)
			case "12:00"
				RegEx.Pattern = "^\(0[0-2]|1[0-2]|0?[0-9]\)\:\([0-5][0-9]\)$"
			case "12:00pm"
				RegEx.Pattern = "^\(0[0-2]|1[0-2]|0?[0-9]\)\:\([0-5][0-9]\)\(p|a\)m$"
			case "24:00"
				RegEx.Pattern = "^\(0[0-9]|1[0-9]|2[0-3]\)\:\([0-5][0-9]\)$"
			end select
			if not RegEx.test(fldValue) then
				ItemValid(index) = false
				exit function
			end if
			
		elseif left(ItemValidate(index),8) = "Equal to" then
			tmp = split(ItemValidate(index) ,",")
			if fldValue <> "" and request(tmp(1)) <> fldValue then
				ItemValid(index) = false
				exit function
			end if
		
		elseif left(ItemValidate(index),7) = "Compare" then
			tmp = split(ItemValidate(index) ,",")
			if fldValue <> "" then
				select case tmp(1)
				case "1"
					if lcase(fldValue) <> lcase(Application(tmp(2)) & "") then
						ItemValid(index) = false
						exit function
					end if
				case "2"
					if lcase(fldValue) <> lcase(Session(tmp(2)) & "") then
						ItemValid(index) = false
						exit function
					end if
				case "3"
					if lcase(fldValue) <> lcase(request.Cookies(tmp(2)) & "") then
						ItemValid(index) = false
						exit function
					end if
				end select
			end if			
		elseif left(ItemValidate(index),11) = "One of them" then
			tmp = split(ItemValidate(index) ,",")
			fieldValid = false
			for J=1 to ubound(tmp)
				if request(tmp(J))<>"" then
					fieldValid = true
					exit for
				end if
			next
			if not fieldValid then
				ItemValid(index) = false
				exit function
			end if
		elseif left(ItemValidate(index),3) = "Any" then
			
		else
			response.Clear()
			response.write("Non riconosciuto: " & ItemFieldName(index) & " " & ItemFieldType(index) & " " & ItemValidate(index))
			response.End()
		end if
	end function
	
	public function getFieldValue(defaultValue,fieldName,formName)
		if isPostBack or isReturnBack then
			getFieldValue = request("dwzValidate_" & fieldName)
		else
			getFieldValue = defaultValue
		end if
	end function
		
	private function ValidateTextArea(index)		
		if ItemRequired(index) = "Yes" then
			if request(ItemFieldName(index)) = "" then
				ItemValid(index) = false
				exit function
			end if
		end if
		
		if request(ItemFieldName(index)) = "" then
			ItemValid(index) = true
			exit function
		end if
		
		tmp = split(ItemFieldLength(index), ",")
		fldValue = request(ItemFieldName(index))
		
		if tmp(2)="Y" and fldValue<>"" then
			fldValue = RemoveHTML(fldValue)
		end if
		
		if tmp(0)<>"" and isNumeric(tmp(0)) then
			if len(fldValue) < clng(tmp(0)) then
				ItemValid(index) = false
				exit function
			end if
		end if
		
		if tmp(1)<>"" and isNumeric(tmp(1)) then
			if len(fldValue) > clng(tmp(1)) then
				ItemValid(index) = false
				exit function
			end if
		end if
	end function
	
	
	private function ValidateCheckBox(index)
		if ItemValidate(index) = "Must" then
			if request(ItemFieldName(index)) = "" then
				ItemValid(index) = false
				exit function
			end if
		end if		
		if left(ItemValidate(index),6) = "filled" and request(ItemFieldName(index)) <> "" then
			tmp = split(ItemValidate(index), ",")
			if request(tmp(1)) = "" then
				ItemValid(index) = false
				exit function				
			end if
		end if	
	end function
	
	
	private function ValidateChkGroup(index)
		fld = split(ItemValidate(index), ",")
		groupValid = false
		if left(ItemValidate(index),3) = "One" then
			for J=0 to ubound(fld)
				if request(fld(J))<>"" then
					groupValid = true
					exit for
				end if
			next
			if not groupValid then
				ItemValid(index) = false
				exit function
			end if
		end if
		
		if left(ItemValidate(index),9) = "ChkMinMax" and ItemFieldLength(index)<>"," then
			tmp = split(ItemFieldLength(index), ",")
			sel = 0
			for J=0 to ubound(fld)
				if request(fld(J))<>"" then
					sel = sel + 1
				end if
			next
			if tmp(0)<>"" and isNumeric(tmp(0)) then
				if sel < clng(tmp(0)) then
					ItemValid(index) = false
					exit function
				end if
			end if
			if tmp(1)<>"" and isNumeric(tmp(1)) then
				if sel > clng(tmp(1)) then
					ItemValid(index) = false
					exit function
				end if
			end if
		end if		
	end function
	
	
	private function ValidateRadio(index)
		if ItemValidate(index) = "One" then
			if request(ItemFieldName(index)) = "" then
				ItemValid(index) = false
				exit function
			end if
		end if	
		if left(lcase(ItemValidate(index)),6) = "filled" and request(ItemFieldName(index)) <> "" then
			tmp = split(ItemValidate(index), ",")
			if request(tmp(1)) = "" then
				ItemValid(index) = false
				exit function				
			end if
		end if
	end function
	
	private function ValidateSelect(index)
		if ItemValidate(index) = "NotFirst" then
			if request(ItemFieldName(index)) = "Null" or request(ItemFieldName(index)) = "" then
				ItemValid(index) = false
				exit function
			end if
		end if
		if ItemValidate(index) = "SelMinMax" and request(ItemFieldName(index)) <> "" then
			tmp = split(ItemFieldLength(index), ",")
			val = split(request(ItemFieldName(index)), ",")
			if tmp(0)<>"" and isNumeric(tmp(0)) then
				if clng(Ubound(val)) < clng(tmp(0)) then
					ItemValid(index) = false
					exit function
				end if
			end if
			if tmp(1)<>"" and isNumeric(tmp(1)) then
				if clng(Ubound(val)) > clng(tmp(1)) then
					ItemValid(index) = false
					exit function
				end if
			end if
		end if
	end function
	
	
	private function RemoveHTML(str)
		Set RegEx = New RegExp 
		RegEx.Pattern = "<[^>]*"
		RegEx.Global = True 
		RegEx.IgnoreCase = True 
		str = RegEx.Replace(str, "")
		
		Set RegEx = New RegExp 
		RegEx.Pattern = "&[\w]{1-6};"
		RegEx.Global = True 
		RegEx.IgnoreCase = True 
		str = RegEx.Replace(str, "_")
		RemoveHTML = str
	end function
	
	
	Public Function createDynamicCombo()	
		dim retStr
		retStr = ""
		if StaticOptionLabel<>"" and StaticOptionValue<>"" then
			tmpLabel = split(StaticOptionLabel, "@_@")
			tmpValue = split(StaticOptionValue, "@_@")
			for J=0 to ubound(tmpLabel)
				if isPostBack or isReturnBack then
					if isOptionSelected(cstr(request(FieldName)), tmpValue(J)) then
						sel = " SELECTED=" & chr(34) & "SELECTED" & chr(34)
					else
						sel = ""
					end if
				else
					if isOptionSelected(ValueEqualTo, tmpValue(J)) then
						sel = " SELECTED=" & chr(34) & "SELECTED" & chr(34)
					else
						sel = ""
					end if
				end if
				retStr = retStr & "<option value='" & tmpValue(J) & "' " & sel & ">" & tmpLabel(J) & "</option>" & vbcrlf
			next
		end if
		dwz_Recordset.requery
		while not dwz_Recordset.eof
			if isPostBack or isReturnBack then
				if isOptionSelected(cstr(request(FieldName)), cstr(dwz_Recordset(ValueColumn))) then
					sel = " SELECTED=" & chr(34) & "SELECTED" & chr(34)
				else
					sel = ""
				end if
			else
				if isOptionSelected(cstr(dwz_Recordset(ValueColumn)), cstr(ValueEqualTo)) then
					sel = " SELECTED=" & chr(34) & "SELECTED" & chr(34)
				else
					sel = ""
				end if
			end if
			retStr = retStr & "<option value='" & dwz_Recordset(ValueColumn) & "' " & sel & ">" & dwz_Recordset(LabelColumn) & "</option>" & vbcrlf
			dwz_Recordset.MoveNext
		wend
		response.write(retStr)
	end function
	
	public function createStaticCombo()
		dim retStr
		retStr = ""
		if StaticOptionLabel<>"" and StaticOptionValue<>"" then
			tmpLabel = split(StaticOptionLabel, "@_@")
			tmpValue = split(StaticOptionValue, "@_@")
			for J=0 to ubound(tmpLabel)
				if isPostBack or isReturnBack then
					if isOptionSelected(cstr(request(FieldName)), tmpValue(J)) then
						sel = " SELECTED=" & chr(34) & "SELECTED" & chr(34)
					else
						sel = ""
					end if
				else
					if isOptionSelected(cstr(ValueEqualTo), tmpValue(J)) then
						sel = " SELECTED=" & chr(34) & "SELECTED" & chr(34)
					else
						sel = ""
					end if
				end if
				retStr = retStr & "<option value='" & tmpValue(J) & "' " & sel & ">" & tmpLabel(J) & "</option>" & vbcrlf
			next
		end if
		response.write(retStr)
	end function
	
	public function getCheckboxSelected(valore,checkIf,fieldName,formName)
		dim retStr
		retStr = ""
		if isPostBack or isReturnBack then
			if request(fieldName)<>"" then
				retStr = " CHECKED "
			end if
		else
			if cstr(valore)<>"" then
				if checkIf <> "" then
					if cstr(checkIf) = cstr(valore) then
						retStr = " CHECKED "
					end if
				else
					if valore then
						retStr = " CHECKED "
					end if
				end if
			end if
		end if
		getCheckboxSelected = retStr
	end function
	
	Public function getRadioSelected(valore,checkIf,fieldName,formName)
		dim retStr
		retStr = ""
		if isPostBack or isReturnBack then
			if cstr(request(fieldName)) = cstr(checkIf) then
				retStr = " CHECKED "
			end if
		else
			if cstr(valore & "")<>"" then
				if cstr(checkIf) = cstr(valore) then
					retStr = " CHECKED "
				end if
			end if
		end if
		getRadioSelected = retStr
	end function
	
	private function isOptionSelected(lista,valore)
		dim retStr
		retStr = false
		if lista <> "" and valore <> "" then
			tmp = split(lista,",")
			for x=0 to ubound(tmp)
				if trim(tmp(x)) = cstr(valore) then
					retStr = true
					exit for
				end if
			next
		end if
		isOptionSelected = retStr
	end function
	
	
	
end class
%>

Anon7 - 2021