<cfset vlangid = 1>
<cfparam name="Form.Berufe_1" default="">
<cfparam name="form.getsubfirst_1" default="">
<cfparam name="form.getsubsecond_1" default="">
<cfform id="SearchForm" name="SearchForm">
<table align="center">
<tr>
<td>
<fieldset>
<label for="Berufe_1">Main</label>
<cfselect name="Berufe_1"
id="Berufe_1"
bind="cfc:test.testrelated5.com.test.q_Beruf(#vlangid#)"
bindonload="true"
value="Berufe_Id"
display="Berufe_Text"
/>
</fieldset>
</td></tr>
<tr><td>
<fieldset>
<label for="getsubfirst_1">1. Child</label>
<cfselect name="getsubfirst_1"
id="getsubfirst_1"
bind="cfc:test.testrelated5.com.test.getBerufefirstsub({Berufe_1},#vlangid#)"
bindonload="false"
value="Subfirstprofi_id"
display="Subfirstprofi_text"
/>
</fieldset>
</tr>
</table>
</cfform>
the cfc:
<cfcomponent>
<cffunction name="q_Beruf" access="remote" returnType="query" output="no">
<cfargument name="vlangid" required="no" default="3">
<cfset var data="">
<cfquery name="data" datasource="#request.dsn#">
SELECT -1 AS Berufe_ID,'select' AS Berufe_Text
FROM dbo.Berufe
UNION
SELECT Berufe_ID,Berufe_Text
FROM dbo.Berufe
WHERE Langid = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.vlangid#">
</cfquery>
<cfreturn data />
</cffunction>
<cffunction name="getBerufefirstsub" access="remote" returnType="query" output="no">
<cfargument name="vlangid" required="no" default="3">
<cfargument name="Berufe_1" type="any" required="true" default="">
<cfset var data="">
<cfset mylist = '4,5,6'>
<cfif listfind(mylist,arguments.Berufe_1)>
<cfquery name="data" datasource="#request.dsn#">
SELECT -1 AS Subfirstprofi_id,'select' AS Subfirstprofi_text
FROM BerufeSubfirst)
UNION
(SELECT Subfirstprofi_id,Subfirstprofi_text
FROM BerufeSubfirst
WHERE MainProfi_ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.Berufe_1#">
AND (Subfirstprofi_id = 1 or Subfirstprofi_id = 1010)
AND LangID = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.vLangId#">
ORDER BY Subfirstprofi_text,Subfirstprofi_id ASC
</cfquery>
<cfelse>
<cfquery name="data" datasource="#request.dsn#">
SELECT Subfirstprofi_id,Subfirstprofi_text
FROM BerufeSubfirst
WHERE MainProfi_ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.berufe_1#">
<cfif arguments.Berufe_1 NEQ 8 AND arguments.Berufe_1 NEQ 3>
AND LangID = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.vLangId#">
</cfif>
</cfquery>
</cfif>
<cfreturn data />
</cffunction>
</cfcomponent>
|