Solved

Dynamic Link in CFGRID

Posted on 2010-11-29
4
434 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 34233641
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
ID: 34233948
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
ID: 34234164
> <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
ID: 34234245
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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

751 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