Hi Gregg,
>
>
>  Paul or whoever  can answer me, having a hard time understanding some of
> this logic.  The next botton and previous buttons do not work, and seem to
> be switched.  Any ideas what I am doing wrong ? Here is the code, thanks.
>

I had a look at the code you gave...  It looked a little over complex, so I
stripped a load of the code out and wound up with this:

<!--- Initialize Constants --->
<CFSET MaxClasses = 5>
<CFPARAM name="form.start" default="1">
<CFQUERY name="manf" datasource="houseboat">
        SELECT id, state, statename, company
        FROM HBMF
        Order by statename
</CFQUERY>
<BODY>
<CFOUTPUT query="manf" group="statename" startrow="#form.start#"
maxrows="#MaxClasses#">
<B><FONT size="+1" color="##6600CC">#statename#</FONT></B><BR>
        <UL>
                <CFOUTPUT>
                        <LI><A href="manufacturers3.cfm?id=#id#"><B>#company#</B></A>
                </CFOUTPUT>
        </UL>
</CFOUTPUT>

<!--- Prev Button Code --->
<cfset prevstart = start - MaxClasses>
<CENTER>
<CFIF PrevStart GTE 1>
        <CFOUTPUT>
                <FORM action="manufacturers.cfm" method="post">
                        <INPUT type="hidden" name="START" value="#PrevStart#">
                        <INPUT type="submit" value="Next #MaxClasses#">
                </FORM>
        </CFOUTPUT>
</CFIF>
</CENTER>

<!--- Next Button Code --->
<cfset NextStart = Start + MaxClasses>
<CENTER>
        <CFIF NextStart LT GetNEWS.RecordCount>
                <CFOUTPUT>
                        <FORM action="index.cfm" method="post">
                                <INPUT type="hidden" name="START" value="#NextStart#">
                                <INPUT type="submit" value="Previous #MaxClasses#">
                        </FORM>
                </CFOUTPUT>
        </CFIF>
</CENTER>

One of the reasons your previous code may not have been working was because
of the use of the start variable.  By not specifying the scope of the
variable and using <cfparam> to check the existance of the variable, you
were probably winding up with a start variable in the 'variables' scope and
one in the 'form' scope and looking at the 'variables' scope version rather
than the one passed from the form.
So what I've done is made sure that the start variable is properly
referenced, by using form.start in the cfparam and for any other references.

Hope this is a little clearer.

Regards

Stephen

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to