Until the form is submitted, TG doesn't exist.  You'll have to use
Javascript. 
Check out this:
http://www.macromedia.com/cfusion/exchange/index.cfm?view=sn130#view=sn106&v
iewName=Exchange%20Search%20Details&loc=en_us&authorid=7653985&page=0&scroll
Pos=0&subcatid=0&snid=sn106&itemnumber=1&extid=1000288&catid=0

-----Original Message-----
From: Colin Coles [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 04, 2005 11:54 AM
To: CF-Newbie
Subject: Re: Form variable in a where clause

[email protected] on Tuesday October 04 2005 at 15:11 +0000
wrote:
>Change <cfset TG =""> to <CFPARAM name="tg" default="">. Otherwise, 
>you've clear TG before the second query.

Hi.  Many thanks for the advice. I have done as you have suggested but I'm
afraid it did not get me any further. If you have any other ideas I'd be
very grateful.
Code is now:
cfquery name="GetTG" datasource="sports_qs">
        SELECT tg
        FROM tblTg
</cfquery>
<CFPARAM name="TG" default="">
<cfquery name="getName" datasource="sports_qs">
        SELECT name, names_tg
        FROM tblNames
        WHERE names_tg = <cfqueryparam value='#TG#'
cfsqltype="cf_SQL_VARchar"> </cfquery> </head> <body>


<table class="text">

</table>
        <hr>
        <table width="600" cellpadding="0" cellspacing="0" class="text">
                <tr>
                <td align="center">Out of School Club Participation
Questionnaire</td>
        </tr>
        <tr>            
      <td align="left">* please fill in all required fields</td>
        </tr>
        </table>
        
  <table width="100%" bgcolor="#CCCCCC" cellpadding="2" cellspacing="0"
class="text">
    <!--- Select Tutor Group from table in database --->
    <tr> 
      <td valign="top">Tutor Group:</td>
          <td colspan="2">
                <cfselect size="1" name="TG" required="yes"
class="smallform"
message="Please select your tutor group.">
                        <cfoutput query="GetTg"><option
value="#GetTg.tg#">#GetTg.tg#</option></cfoutput> 
                </cfselect>
        </td>
    </tr>
<!--- Field: Select Name from List generated by variable TG above by
filtering tblNames with that variable --->

        <tr>
        <td valign="top">Name:</td>
    <td colspan="2">
                <cfselect size="1" name="Name" required="yes"
class="smallform"
message="Please select your name from the list.">
                        <cfoutput query="getName"><option
value="#getName.name#">#GetName.name#</option>                  </cfoutput> 
                </cfselect></td>
    </tr>

</table>
        <input type="submit" value="Submit" class="smallform">
        <input type="reset" value="Reset" class="smallform">
        <input type="submit" value="Cancel" class="smallform">
        </cfform>
</p>
Colin


Colin Coles
ICT Development Manager
John Cabot City Technology College
Tel 0117 976 3000 Ext 2112
Mobile: 07734395347
E Mail: [EMAIL PROTECTED]
Alt: [EMAIL PROTECTED]




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1409
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to