Solved

Dynamic Link in CFGRID

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

810 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