Time:
Scotland: Fri, 9:43 pm
Rhode Island: Fri, 4:43 pm
Florida: Fri, 4:43 pm
New Mexico: Fri, 2:43 pm
California: Fri, 1:43 pm

Click here to visit Livelife365.com

Click here to visit nmdarts.com



Buy this Ad Space.

180px wide.

Please get in touch with KH@ if you are interested and make an offer.

CLICK HERE TO GET AUCTION BAR NOW
US$10 per year - Save $100s!
The Fabulously Unfair
WebX Auction Bar. For Ebay etc.
Ro-Sham-Bo the opposition. Laugh like Eric Cartman when you win! CLICK HERE NOW!


More information and sign-up.

WebXpertz Hosting.
Custom fit from $5pm. PHP/MySQL
You'll save money, we'll save money. Seems fair to me. Interested? If so Please PM me here and tell me what you need. Thanks!


Please click here for more information

For continued disscussion on this topic : Error in CFIF tags


mindytruitt
07-08-2004, 12:47 AM
I am having trouble, this is part of my code but when I run it, it keeps saying that the last closing If statement </CFIF> doesnt have a matching starter tag, but when I delete it the first if statement says it doesn't have a matching end tag. any ideas??

<form name="AllEdit" action="chargeabilityReportWeekEntryVerify.cfm" method=post>

<cfoutput query="Employees" group="UserName">
<CFIF Charge.Sales eq 3>

<CFSET RunningCharge = ChargeHours + RunningCharge>
<CFSET RunningIntCharge = InternalHours + RunningIntCharge>
<CFSET RunningLeave = VacationHours + RunningLeave>
<CFSET RunningNassign = NassignHours + RunningNassign>
<CFSET RunningAvailable = AvailableHours + RunningAvailable>

<input type="hidden" name="Employee" value="#Charge.UserID#"></cfoutput>
<cfoutput query="Charge">
<input type="hidden" name="Week" value="#Week#">
<input type="hidden" name="FiscalYear" value="#FiscalYear#"></cfoutput>
<cfoutput query="Employees">
<CFIF AvailableHours NEQ 0>

<tr>
<td width="100"><font face="Arial, Helvetica, sans-serif" size="1"><a href="ChargeabilityReportDetail.cfm?ID=#UserID#">#fullname#</A></font></td>
<td width="40" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1">#NumberFormat(ChargeHours, "__._")#</font></td>
<td width="50" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1">#NumberFOrmat(InternalHours, "__._")#</font></td>
<td width="50" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1">#NumberFOrmat(VacationHours, "__._")#</font></td>
<td width="45" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1">#NumberFormat(NassignHours, "__._")#</font></td>
<td width="50" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1">#NumberFormat(AvailableHours, "__._")#</font></td>
<td width="50" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1">#DecimalFormat(ChargeHours/AvailableHours*100)# %</font></td>
</tr>
<cfoutput query="Charge">
<input type=hidden name="ChargeHours" value="#NumberFormat(ChargeHours, "__._")#">
<input type=hidden name="InternalHours" value="#NumberFOrmat(InternalHours, "__._")#">
<input type=hidden name="VacationHours" value="#NumberFOrmat(VacationHours, "__._")#">
<input type=hidden name="NassignHours" value="#NumberFormat(NassignHours, "__._")#">
<input type=hidden name="AvailableHours" value="#NumberFormat(AvailableHours, "__._")#">
</cfoutput>



<CFELSE>

<tr>
<td width="100"><font face="Arial, Helvetica, sans-serif" size="1"><a href="ChargeabilityReportDetail.cfm?ID=#UserID#">#fullname#</A></font></td>
<td width="40" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1"><input type=text name="ChargeHours" size=3 ></font></td>
<td width="50" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1"><input type=text name="InternalHours" size=3 ></font></td>
<td width="50" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1"><input type=text name="VacationHours" size=3 ></font></td>
<td width="45" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1"><input type=text name="NassignHours" size=3 ></font></td>
<td width="50" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1"><input type=text name="AvailableHours" size=3 ></font></td>
<td width="50" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1"> - </font></td>
<td width="50" Align="Right"><font face="Arial, Helvetica, sans-serif" size="1"><input type="submit" name="Submit" value="OK"></td>
</tr>

</CFIF>
</CFIF>
</form>

Vincent Puglia
07-08-2004, 01:17 AM
you have to move one of the </cfif>s where depends on what you want:

cfif
cfif
/cfif
cfelse
/cfif

or

cfif
/cfif
cfif
cfelse
/cfif

etc....
as it stands now you have
if
if
else
/if
/if

to whom does the else belong?

Vinny

hotpepper
07-08-2004, 10:41 PM
I don't think this is the problem, Vinny. There should be no problems nesting conditional statements.


<cfif>
<cfif>
Code
<cfelse>
Code
</cfif>
</cfif>


mindytruitt, you problem actually may be related to one of the last two output tags not being closed. You will run into problems when nesting output tag. In actuality, You should have a single output tag and use<cfloop query=""></cfloop> to output the results of multiple queries.

fizzled
07-21-2004, 03:36 AM
I've also had problems before when I open cfoutput outside a cfif and close it inside or vice versa. If you open cfoutput outside, close it outside. If you open it inside, close it inside the same block. Ex:

<!--- The following can cause problems --->
<cfoutput>
<cfif condition>
<cf_dostuff>
</cfoutput>
<cfelse>
<cf_dootherstuff>
</cfoutput>
</cfif>

<!--- Should be --->
<cfoutput>
<cfif condition>
<cf_dostuff>
<cfelse>
<cf_dootherstuff>
</cfif>
</cfoutput>

<!--- Alternatively, it could be --->
<cfif condition>
<cfoutput>
<cf_dostuff>
</cfoutput>
<cfelse>
<cfoutput>
<cf_dootherstuff>
</cfoutput>
</cfif>

Not sure if that is the problem here since, as flashjunkie mentioned, you are missing a closing tag for one of your cfoutputs.