• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFGRID HREF

New Here ,
Feb 19, 2007 Feb 19, 2007

Copy link to clipboard

Copied

How can I create a URL in href for each record where the query parameters are the values of the selected record.
I tried the following:
<cfgrid name="mygrid" query="getproducts">
<cfgridcolumn name="prod" href="#order_url#?prod=#getproducts.product#" hrefkey="product">
</cfgrid>

The problem with this is, no matter what product I selected, it will still pass the first record in the table.
TOPICS
Advanced techniques

Views

2.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 20, 2007 Feb 20, 2007

Copy link to clipboard

Copied

Try the following:
<cfgrid name="mygrid" query="getproducts">
<cfgridcolumn name="prod" href="#order_url# hrefkey="product">
</cfgrid>

When you click on the href link it will pass the value of the product in CFGRIDKEY. See "Using the href attribute" in http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFu....

Then when you do your where clause on your linked page it will be WHERE PRODUCT=#URL.CFGRIDKEY#.

Ted Zimmerman

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 07, 2007 Mar 07, 2007

Copy link to clipboard

Copied

I am trying to do something similar - I want the user to be able to navigate to a non-cfm page to do an employee lookup from a corporate ldap using a list of employees in a cfgrid. How can I get this to work?
The search string should look like this (assuming 1111 is the employee number):
http://myhome.com/employee_lookup?Search=1111

Here is my code so far:
<cfgrid name="mygrid" query="get_employees">
<cfgridcolumn name="staff_id_nbr" href=" http://myhome.com/employee_lookup?Search=#get_employees.staff_id_nbr#" target="_blank" >
</cfgrid>

This is the result (displays the employee info, but adds too much info to the address):
http://myhome.com/employee_lookup?Search1111&CFGRIDKEY=1111%2CAblay%2CMaria%2CSr+Technical+Analyst%2...

How do I get rid of all the garbage, starting with &CFGRIDKEY? Some of it is Employee LDAP info, but I'm most concerned about the &CFGRIDKEY=1111. I tried using the hrefkey in various ways, but luck. Thanks...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 30, 2007 May 30, 2007

Copy link to clipboard

Copied

I get all that same garbage as well. How can I clean it up so that original "=" and "&" symbols show up?

http://ixa01/testsite/site01/coldfusion/timeoff/logbook_status_page2.cfm?CFGRIDKEY=code%3DBOWN+Z%26n...

My next page won't even recognize the URL variables because of all that %3D%3f%26 garbage.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 07, 2007 Dec 07, 2007

Copy link to clipboard

Copied

I was in the same situation as you folks. Closer inspection of the documentation led me to the solution:

The key is to ensure that you have the following three parameters in your cfgrid tag:

href (for the url - you can add any other parameters you want to pass here)
hrefkey (the id you want to pass through to the target page)
appendkey (the attribute you were missing - according to the docs, this is required)

<cfform>
<cfgrid name="myGrid"
format="html"
pagesize="10"
selectmode="single"
href="yourURL?myparam1=myvalue1"
hrefkey="PK_PAGE_CONTENT"
appendkey="yes"
sort="yes"
striperows="yes"
bind="cfc:pages.getMyRecords({cfgridpage},
{cfgridpagesize},
{cfgridsortcolumn},
{cfgridsortdirection})">
<cfgridcolumn name="PK_MY_PRIMARY_KEY" display="no" />
<cfgridcolumn name="DISPLAYCOL1" header="Col1Header" />
<cfgridcolumn name="DISPLAYCOL2" header="ColHeader2" />
<cfgridcolumn name="DISPLAYCOL3" header="ColHeader3" />
</cfgrid>
</cfform>

Hope that helps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 07, 2007 Dec 07, 2007

Copy link to clipboard

Copied

LATEST

baitband wrote:
> <cfform>
> <cfgrid name="myGrid"
...
> hrefkey="PK_PAGE_CONTENT"
...

you surely meant PK_MY_PRIMARY_KEY, didn't you?
(sorry if you edited your post and corrected it - i read these forums as
nntp/news and do not get post edits...)

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation