Solved

Dynamic Link in CFGRID

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
The viewer will learn how to dynamically set the form action using jQuery.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

911 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

19 Experts available now in Live!

Get 1:1 Help Now