<cfsilent></cfsilent>
	<cfif thisTag.executionMode IS "end" OR !thisTag.hasEndTag>
	
		<cfassociate basetag="cf_submit_collection" datacollection="params" />	
		
		<cfparam name="ATTRIBUTES.name"/>
		<cfparam name="ATTRIBUTES.type" default="string"/>
		<cfparam name="ATTRIBUTES.default" default=""/><!--- не валидируется, что позволяет использовать, например, пустую строку для индикации нулла в числовой колонке --->
		
		<!--- output params --->
		<cfparam name="ATTRIBUTES.submittedValue" type="string" default=""/>	
		<cfparam name="ATTRIBUTES.value" type="any" default=""/>	
		
		
		<cfif structKeyExists(CALLER.VARIABLES, "#ATTRIBUTES.name#")> 	
			<cfset ATTRIBUTES.submittedValue=CALLER.VARIABLES["#ATTRIBUTES.name#"]/>
		<cfelseif structKeyExists(FORM, "#ATTRIBUTES.name#")> 	
			<cfset ATTRIBUTES.submittedValue=FORM["#ATTRIBUTES.name#"]/>
		<cfelseif structKeyExists(URL, "#ATTRIBUTES.name#")> 	
			<cfset ATTRIBUTES.submittedValue=URL["#ATTRIBUTES.name#"]/>
		<cfelse>	
			<cfset ATTRIBUTES.submittedValue=#ATTRIBUTES.default#/>			
		</cfif>	
		
		<cfif structKeyExists(ATTRIBUTES,"preprocessor")>
			<cfset preprocessedValue=#ATTRIBUTES.preprocessor(ATTRIBUTES.submittedValue)#/>
		<cfelse>
			<cfset preprocessedValue=#ATTRIBUTES.submittedValue#/>
		</cfif>
		
		
		<cfswitch expression=#ATTRIBUTES.type#>
			<cfcase value="integer">
				<cfif isValid('integer', preprocessedValue)>
					<cfset ATTRIBUTES.value=preprocessedValue/>
				<cfelseif isValid('number', preprocessedValue)>
					<cfset ATTRIBUTES.value=round(preprocessedValue)/>
				<cfelse>
					<cfset ATTRIBUTES.value=#ATTRIBUTES.default#/>
				</cfif>		
			</cfcase>
			
			<cfcase value="numeric">
				<cfif isValid('numeric', preprocessedValue)>
					<cfset ATTRIBUTES.value=preprocessedValue/>
				<cfelse>
					<cfset ATTRIBUTES.value=#ATTRIBUTES.default#/>
				</cfif>		
			</cfcase>		
			
			<cfcase value="datetime">
				<cfparam name="ATTRIBUTES.locale" default="ru"/>
				<cfparam name="ATTRIBUTES.format" default=""/>
			
				<cftry>
					<cfset ATTRIBUTES.value=LSParseDateTime(preprocessedValue, #ATTRIBUTES.locale#, #ATTRIBUTES.format#)/>	
					<cfcatch type="ANY">
						<cfset ATTRIBUTES.value=#ATTRIBUTES.default#/>
					</cfcatch>
				</cftry>		
			</cfcase>
			
			<cfcase value="string">
				<cfset ATTRIBUTES.value=preprocessedValue/>
			</cfcase>
		
		</cfswitch>
	
	</cfif>