Solved

Dynamic Link in CFGRID

Posted on 2010-11-29
4
401 Views
Last Modified: 2012-05-10
Here is the code I'mm using

<cfgridcolumn name="businessName" width="200" header="Business Name" href="detailcoupon.cfm" hrefkey="id"/>

The out put looks like this
http://localhost:8500/mymobisaver/detailcoupon.cfm?CFGRIDKEY=myMobi%20Saver%20test's',Get%201%20free%20coupon%20today,Cleveland,December,%2031%202010%2000:00:00

I want it to look like
http://localhost:8500/mymobisaver/detailcoupon.cfm??recordid=26

How do I fix this please
0
Comment
Question by:sonicimpulse
  • 2
  • 2
4 Comments
 
LVL 52

Expert Comment

by:_agx_
Comment Utility
hrefkey="id"/>

Make sure the key is the name of one of your grid columns (not the header name).

ie
<cfgridcolumn name="ColAName" header="ColAHeader" ...>
<cfgridcolumn .... href="detailcoupon.cfm" hrefkey="ColAName"/>

See also http://livedocs.adobe.com/coldfusion/8/Tags_g-h_03.html#3987906


I want it to look like
http://localhost:8500/mymobisaver/detailcoupon.cfm??recordid=26


AFAIK, the url.parameter name will always be CFGRIDKEY.  I don't think you can change that.
0
 

Author Comment

by:sonicimpulse
Comment Utility
Does not work.  i get an error that says.

Attribute validation error for tag CFGRIDCOLUMN.  
It requires the attribute(s): NAME.  

My code is below.
<cfform name="CouponForm">

	<cfgrid format="html" name="parkGrid" pagesize="10" selectmode="row" bind="cfc:listCoups.getParks({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})">

    	<cfgridcolumn name="id" header="id">

		<cfgridcolumn name="businessName" width="200" header="Business Name" href="detailcoupon.cfm" hrefkey="id"/>

        <cfgridcolumn href="detailcoupon.cfm" hrefkey="id"/>

		<cfgridcolumn name="cDescription" width="200" header="Coupon" />

		<cfgridcolumn name="city" width="120" header="City" />

		<cfgridcolumn name="expDate" width="150" header="Exp Date" mask="mm/dd/yy" />

	</cfgrid>

</cfform>

Open in new window

0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
Comment Utility
> <cfgridcolumn ....

That wasn't meant to be literal code.  When you see "..." it always means some stuff that isn't relevant to the answer, was omitted for clarity. But you still need it in the actual code  ;-)

I tested an abbreviated version of your grid, and it works fine. When you click a business name, the url is something like

http://localhost:8500/myDirec/detailcoupon.cfm?CFGRIDKEY=79

<cfform name="CouponForm">
      <cfgrid format="html" name="parkGrid" pagesize="10" selectmode="row" bind="cfc:listCoups.getParks({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})">
          <cfgridcolumn name="id" header="id">
            <cfgridcolumn name="businessName" width="200" header="Business Name" href="detailcoupon.cfm" hrefkey="id"/>
      </cfgrid>
</cfform>
0
 

Author Closing Comment

by:sonicimpulse
Comment Utility
Thanks so much that worked.  I'm also having an issue formating the date in a column.  If you have time take a look at it.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now