Solved

Dynamic Link in CFGRID

Posted on 2010-11-29
4
427 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
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 …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

763 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