CFGrid Help

I need help creating a link inside a CFGrid.  Below is my code.  The problem is the output the code is generating.

The ouput:
http://mymobisaver.com/detailcoupon.cfm?CFGRIDKEY=38,Tammy's%20Oasis%20inside%20Cuttin'%20It%20Up!,25%25%20off%20%0D%0AHis%20&%20Hers%20Fragrances%20,Cuyahoga%20Falls,02-09-12

All I want the link to contain is:
http://mymobisaver.com/detailcoupon.cfm?CFGRIDKEY=38

Below is my Code:
<cfform name="CouponForm" format="html">
              <cfgrid name="parkGrid" selectmode="row" format="html" pagesize="8" width="580" bind="cfc:listCoups.getParks({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})">
                <cfgridcolumn name="Cid" header="id" display="no">
                <cfgridcolumn name="businessName" width="200" textcolor="Blue" header="Business Name" href="detailcoupon.cfm" hrefkey="id"/>
                <cfgridcolumn name="cDescription" width="200" header="Coupon" href="detailcoupon.cfm" hrefkey="id" />
                <cfgridcolumn name="city" width="110" header="City" href="detailcoupon.cfm" hrefkey="id" />
                <cfgridcolumn name="NEWexpDate" width="70" header="Exp Date" href="detailcoupon.cfm" hrefkey="id" />
              </cfgrid>
            </cfform>

Open in new window

sonicimpulseAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RickEpnetCommented:
I think we need to take a look at your CFC and the query in it. Do you ahve any idea why your ID field is giving you all the extra information.

38 is all you want but it is givings you all this extra.

38,Tammy's Oasis inside Cuttin' It Up!,25% off His

Myself I normally only have one column with a hrefkey="id"

0
sonicimpulseAuthor Commented:
Here is the code in my CFC:
<cffunction name="restaurants" access="remote" returntype="struct">
	<cfargument name="page" required="true" />
	<cfargument name="pageSize" required="true" />
	<cfargument name="gridsortcolumn" required="true" />
	<cfargument name="gridsortdirection" required="true" />
	
	<cfif arguments.gridsortcolumn eq "">
		<cfset arguments.gridsortcolumn = "businessName" />
		<cfset arguments.gridsortdirection = "asc" />
	</cfif>
    
	<cfset todayDate = Now()>
	<cfquery name="ListCoups" datasource="security">
SELECT  *, DATE_FORMAT(expdate, '%m-%d-%y') AS NewExpDate, coupon.id AS cID
FROM     coupon,member
WHERE  coupon.memberid=member.id and coupon.catagoryid=1 and coupon.expdate>#todayDate#
ORDER BY coupon.expdate asc
	</cfquery>

	<cfreturn queryconvertforgrid(listCoups, page, pagesize) />
</cffunction>

Open in new window

0
_agx_Commented:
> Myself I normally only have one column with a hrefkey="id"

What happens if you try Rick's suggestion? ie Only make 1 column a link instead of all of them.

0
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

RickEpnetCommented:
From your code I can see you must have multiple field with the name ID coupon.id and member.id.

How does the grid know which ID to use? What about if you changed the grid to show the cID like this?

<cfform name="CouponForm" format="html">
              <cfgrid name="parkGrid" selectmode="row" format="html" pagesize="8" width="580" bind="cfc:listCoups.getParks({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})">
                <cfgridcolumn name="Cid" header="id" display="no">
                <cfgridcolumn name="businessName" width="200" textcolor="Blue" header="Business Name" href="detailcoupon.cfm" hrefkey="cid"/>
                <cfgridcolumn name="cDescription" width="200" header="Coupon" href="detailcoupon.cfm" hrefkey="cid" />
                <cfgridcolumn name="city" width="110" header="City" href="detailcoupon.cfm" hrefkey="cid" />
                <cfgridcolumn name="NEWexpDate" width="70" header="Exp Date" href="detailcoupon.cfm" hrefkey="cid" />
              </cfgrid>
            </cfform>
0
_agx_Commented:
> you must have multiple field with the name ID coupon.id and member.id.

Oh, I missed the evil SELECT *.  If that's the real problem, better to modify the underlying SELECT instead to eliminate the ambiguity IMO. Only include the columns you're using in the grid. No reason to return extra data if it's not being used.
0
sonicimpulseAuthor Commented:
That does not fix my problem with the HTML link though.  I do agree I should not have the evil SELECT * in my code.  I'm going to get rid of it.
0
RickEpnetCommented:
What field(s) is this information coming from?

Tammy's Oasis inside Cuttin' It Up!,25% off His
0
sonicimpulseAuthor Commented:
ID
BName
CName
CDisclaimer
Baddress
Bcity
BState
Bzip
EXPDate

0
_agx_Commented:
Which one of those columns contains the data values Rick posted?
0
sonicimpulseAuthor Commented:
Bname
Cname
0
RickEpnetCommented:
So that field is getting into the Variable ID some how. agx do you see how that is happening? I do not see it.
0
RickEpnetCommented:
I should say those fields
0
sonicimpulseAuthor Commented:
I have an idea for a work around.  I did a cfoutput on the variable to see exactly what it contain and here is the result.

26,Spc Sports,10% off any retail purchase! ,Mentor,12-31-11

Is there away to strip the contents of the string so I only get the first set of numbers?  
Keep everything untill you get to the first comma.
0
sonicimpulseAuthor Commented:
I guess I should make that a question.  Leave this open to see if anyone can fix it.
0
RickEpnetCommented:
That is not the correct way of doing it. The variable should only contain the number. How is that orher data getting in there? That is why I ask which field that data was in.
0
RickEpnetCommented:
If you want to strip it out it is pretty easy to do. When I get back to a computer I can write it out or maybe agx would post it.
0
_agx_Commented:
Sorry guys, just got back.

I'm not near a CF install right now but .. since the values are separated by commas you use list functions to grab the first or nth value. But better to figure out why it's happening .. because something seems off.

     ie 26,Spc Sports,10% off any retail purchase! ,Mentor,12-31-11
         <cfset value = listFirst(theVariable, ",")>   <=== first value ie 26
         <cfset value = listGetAt(theVariable, 2, ",")>   <=== second value "Spc Sports"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.