were a ton of mistakes�
This code actually works. Just change the list of tables and it�s
displaytext list as well as the datasource on the query.
<!--- make a valid list of tables to choose from for the second field --->
<cfset goodtables = "mvp_images,sigevents_images">
<!--- make a list of displaytext for the good tables (positions must match)
--->
<cfset displaytext = "MVP Images,Signature Event Images">
<cfparam name="form.firstfield" default="0">
<cftry>
<cfset temp = ListGetAt(goodtables, form.firstfield)>
<cfset GetSecondRecs = true>
<cfcatch type="any">
<cfset getSecondRecs = False>
</cfcatch>
</cftry>
<!--- if getsecondrecs is true then get the records form the table that is
in the list at form.firstfields position--->
<!--- you could make the values of the fields the names of the tables, but I
wouldnt suggest putting your table names in plain view --->
<cfif GetSecondRecs>
<cfquery name="SecondQry" datasource="mydsn">
Select recordid, recordtext from #ListGetat(goodtables,
form.firstfield)#
</cfquery>
</cfif>
<cfoutput>
<form name="test" action="" method="post">
<select name="firstfield" size="1" >
<option value="0">--- MAKE A SELECTION ---</option>
<cfloop from="1" to="#listLen(goodtables)#" index="i">
<option value="#i#"<cfif form.firstfield is i>
selected</cfif>>#listgetat(displaytext, i)#</option>
</cfloop>
</select>
<select name="secondfield" size="1">
<option value="0">--- MAKE A SELECTION ---</option>
<cfif GetSecondRecs>
<cfloop query="SecondQry">
<option
value="#recordid#">#recordtext#</option>
</cfloop>
</cfif>
</select>
<br>
<input type="submit" name="submitit" value="submit me">
</form>
</cfoutput>
<!--- only include your action page (or next page) if the submit button was
used to submit --->
<cfif isdefined("form.submitit")>
The button was clicked so do your validation and continue on from here
</cfif>
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.759 / Virus Database: 508 - Release Date: 9/9/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.759 / Virus Database: 508 - Release Date: 9/9/2004
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

