<CFIF> Structure not working? What am I doing wrong?
Back at it. Hope I can figure this out today. Thanks again. There is one persnickety problem though. I have the DB set to a yes/no on certain items in a <cfif> structure. However, when the structure is processed it does not recognize the structure and continues to return the <cfelse> instead. I have tried changing the 1 to '1' and "1". I have also attempted using the isDefined('doubles'), but that did not work.
The previous page sends the URL.tName to this page.
<a href="" onclick='NewWindow("/forms/T-Register.cfm?tName=#getTournaments.tName#&tDate=#getTournaments.tDate#", "register",750,900,"yes");return false;'><img src="/images/regButton.jpg" width="100" height="22" /></a>
As I said the DB fields for these below are set to yes/no, which is either 1 or 0. Obviously I am doing something wrong, but what is it? The <cfif> structure is not being ignored because it returns the last item <cfelse>. The statements are either true or false. At present it is as though the statements are all being read as false and the only thing that is true is the <cfelse>. Should I be scoping the <cfif> with the query? Any ideas out there. I am not a rocket scientist programmer, but know enough to get by.
<cfquery name="getTournaments" datasource="RBDS">
SELECT *
FROM tournamentFeatures
WHERE tName = '#URL.tName#'
</cfquery>
<cfif tName EQ #URL.tname# AND 'doubles' EQ 1>
<!--- #URL.tname# must have '#" signs around it because it is comparing the database "tname" to the URL.tname.
Aslo, the 'doubles' variable needs to be defined with tick marks because you are calling the valur from the
database.--->
<div class="redTextNORM">This is a Doubles Tournament. Please fill in the required information for the other team member.
<!---Tool Tip Begin--->
<a href="bowlingPartners.cfm" onClick="return show_hide_box(this,200, 425,'2px dotted','scroll')">More Info</a>
<!---Tool Tip End--->
</div>
<br />
<div class="g"><cfinput type="text" name="BowlerTwoName" value="Name of Bowler 2" required="yes" onblur="if(this.value=='') this.value='Name of Bowler 2'" onfocus="if(this.value =='Name of Bowler 2' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerTwoBook" value="Bowler 2 Average" required="no" onblur="if(this.value=='') this.value='Bowler 2 Average'" onfocus="if(this.value =='Bowler 2 Average' ) this.value=''" /></div>
<cfelseif tName EQ #URL.tname# AND 'threePerTeam' EQ '1'>
<div class="redTextNORM">This tournament consists of a three person team. Please fill in the required information for the other team members.
<!---Tool Tip Begin--->
<a href="bowlingPartners.cfm" onClick="return show_hide_box(this,200, 425,'2px dotted','scroll')">More Info</a>
<!---Tool Tip End--->
</div>
<br />
<div class="g"><cfinput type="text" name="BowlerTwoName" value="Name of Bowler 2:" required="yes" onblur="if(this.value=='') this.value='Name of Bowler 2:'" onfocus="if(this.value =='Name of Bowler 2:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerTwoBook" value="Bowler 2 Average:" required="no" onblur="if(this.value=='') this.value='Bowler 2 Average:'" onfocus="if(this.value =='Bowler 2 Average:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerThreeName" value="Name of Bowler 3:" required="yes" onblur="if(this.value=='') this.value='Name of Bowler 3:'" onfocus="if(this.value =='Name of Bowler 3:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerThreeBook" value="Bowler 3 Average:" required="no" onblur="if(this.value=='') this.value='Bowler 3 Average:'" onfocus="if(this.value =='Bowler 3 Average:' ) this.value=''" /></div>
<cfelseif tName EQ #URL.tname# AND 'fourPerTeam' IS 'yes'>
<div class="redTextNORM">This tournament consists of a four person team. Please fill in the required information for the other team members.
<!---Tool Tip Begin--->
<a href="bowlingPartners.cfm" onClick="return show_hide_box(this,200, 425,'2px dotted','scroll')">More Info</a>
<!---Tool Tip End--->
</div>
<br />
<div class="g"><cfinput type="text" name="BowlerTwoName" value="Name of Bowler 2:" required="yes" onblur="if(this.value=='') this.value='Name of Bowler 2:'" onfocus="if(this.value =='Name of Bowler 2:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerTwoBook" value="Bowler 2 Average:" required="no" onblur="if(this.value=='') this.value='Bowler 2 Average:'" onfocus="if(this.value =='Bowler 2 Average:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerThreeName" value="Name of Bowler 3:" required="yes" onblur="if(this.value=='') this.value='Name of Bowler 3:'" onfocus="if(this.value =='Name of Bowler 3:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="bowlerThreeBook" value="Bowler 3 Average:" required="no" onblur="if(this.value=='') this.value='Bowler 3 Average:'" onfocus="if(this.value =='Bowler 3 Average:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerFourName" value="Name of Bowler 4:" required="yes" onblur="if(this.value=='') this.value='Name of Bowler 4:'" onfocus="if(this.value =='Name of Bowler 4:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerFourBook" value="Bowler 4 Average:" required="no" onblur="if(this.value=='') this.value='Bowler 4 Average:'" onfocus="if(this.value =='Bowler 4 Average:' ) this.value=''" /></div>
<cfelseif tName EQ #URL.tname# AND 'fivePerTeam' IS 'yes'>
<div class="redTextNORM">This tournament consists of a five person team. Please fill in the required information for the other team members.
<!---Tool Tip Begin--->
<a href="bowlingPartners.cfm" onClick="return show_hide_box(this,200, 425,'2px dotted','scroll')">More Info</a>
<!---Tool Tip End--->
</div>
<br />
<div class="g"><cfinput type="text" name="BowlerTwoName" value="Name of Bowler 2:" required="yes" onblur="if(this.value=='') this.value='Name of Bowler 2:'" onfocus="if(this.value =='Name of Bowler 2:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="bowlerTwoBook" value="Bowler 2 Average:" required="no" onblur="if(this.value=='') this.value='Bowler 2 Average:'" onfocus="if(this.value =='Bowler 2 Average:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerThreeName" value="Name of Bowler 3:" required="yes" onblur="if(this.value=='') this.value='Name of Bowler 3:'" onfocus="if(this.value =='Name of Bowler 3:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerThreeBook" value="Bowler 3 Average:" required="no" onblur="if(this.value=='') this.value='Bowler 3 Average:'" onfocus="if(this.value =='Bowler 3 Average:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerFourName" value="Name of Bowler 4:" required="yes" onblur="if(this.value=='') this.value='Name of Bowler 4:'" onfocus="if(this.value =='Name of Bowler 4:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerFourBook" value="Bowler 4 Average:" required="no" onblur="if(this.value=='') this.value='Bowler 4 Average:'" onfocus="if(this.value =='Bowler 4 Average:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerFiveName" value="Name of Bowler 5:" required="yes" onblur="if(this.value=='') this.value='Name of Bowler 5:'" onfocus="if(this.value =='Name of Bowler 5:' ) this.value=''" /></div>
<div class="g"><cfinput type="text" name="BowlerFiveBook" value="Bowler 5 Average:" required="no" onblur="if(this.value=='') this.value='Bowler 5 Average:'" onfocus="if(this.value =='Bowler 5 Average:' ) this.value=''" /></div>
<cfelse>
<div class="redTextNORM">This is a Singles Tournament</div>
<cfinput type="hidden" name="singles" value=1>
</cfif>
When I change the first instance to this:
<cfif tName EQ #URL.tname# AND 'doubles' IS NOT 1>
It works. But it seems backwards. In the database the tournament (Super No-Tap) is set to "1" or yes. The <cfif> rule is is the tournament is not "yes" or "1" then it should bypass it to the next group (cfif). I know its early but I feel a bit bonkers at this point.
