Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Displaying Shipment Tracking Information in Coldfusion

Posted on 2014-11-11
7
Medium Priority
?
149 Views
Last Modified: 2014-11-15
Order HistoryFedEx Tracking Information
Hi,
  I have a CFM page where I display order information along with tracking number. When I click "TrackingNo" field, I would like to display tracking information provided by FedEx website based on the tracking number in the Order Listing Form/CFGRID.
  Below is my actual CFM code and FedEx URL.
 How can I modify current code to display tracking information from FedEx website when the user clicks "TrackingNo" from the CFGRID?
 
https://www.fedex.com/fedextrack/WTRK/index.html?action=track&action=track&tracknumbers=123456789&fdx=1490
 
<cfform action = "#CGI.SCRIPT_NAME#">
    <cfgrid name = "FirstGrid" width = "900"
            query = "GetOrderHistory" colheaderbold="Yes"
            font = "Tahoma" rowHeaders = "No"
            selectColor = "Red" selectMode = "Edit" format="HTML" > 
        <cfgridcolumn name="StoreID" header="StoreID" width=70>
        <cfgridcolumn name = "TrackingNo" header = "TrackingNo" Select="No" width="150" textcolor="blue" bold="Yes"> href="ShippingInfo.cfm" hrefkey="ID">
        <cfgridcolumn name = "Location" header = "Location" Select="No" width="200" bold="Yes">
        <cfgridcolumn name="City" header="City" width=100>
    </cfgrid>
    <br>
    <cfinput type="submit" name="gridEntered">
</cfform>
0
Comment
Question by:sglee
  • 3
  • 2
  • 2
7 Comments
 
LVL 25

Expert Comment

by:dgrafx
ID: 40437663
Do you mean you want to display a Fedex page like shown above on your website?
Investigate their webservices here: http://www.fedex.com/us/web-services/
0
 

Author Comment

by:sglee
ID: 40437697
@dgrafx
my goal, when the user clicks the link(FedEx tracking#), is to go to FedEx website and display what they provide.
It is just like you and I go to FedEx.com and enter the tracking number to display shipping status.
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 40437717
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 40438904
I don't use cfgrid much - but AFAIK, there's no simple way to make that happen. Honestly the CF ajax stuff is a bit of a pain to extend and workarounds for CF8 won't necessarily work in 9 or 10. Anyway, the closest I could get to "simple" is this (tested w/CF10).

Note: MUST set appendKey="false" or the javascript won't work

<script type="text/javascript">
	function displayFedexPage() {
                // get reference to grid
		var grid = ColdFusion.Grid.getGridObject('FirstGrid');
               // if something is selected
		if (grid.getSelectionModel().hasSelection()) {
                    // get selected row
		   var row = grid.getSelectionModel().getSelected();
                   // get value in tracking number value
		   var trackingNo = row.get('TRACKINGNO');
                   // go to fedex tracking page
		   window.location.href = "http://www.fedex.com/Tracking?action=track&tracknumbers="+ trackingNo;
		}
	}
</script>
<cfform action = "#CGI.SCRIPT_NAME#">
    <cfgrid name = "FirstGrid" width = "900"
            query = "GetOrderHistory" colheaderbold="Yes"
            font = "Tahoma" rowHeaders = "No"
            selectColor = "Red" selectMode = "Edit" format="HTML"
	    appendKey="false">
        <cfgridcolumn name="StoreID" header="StoreID" width=70>
        <cfgridcolumn name = "TrackingNo" header = "TrackingNo" 
			href="javascript:displayFedexPage()"
			hrefKey="TrackingNo"
			Select="No" width="150" textcolor="blue" bold="Yes"> 
        <cfgridcolumn name = "Location" header = "Location" Select="No" width="200" bold="Yes">
        <cfgridcolumn name="City" header="City" width=100>
    </cfgrid>
    <br>
    <cfinput type="submit" name="gridEntered">
</cfform> 

Open in new window

0
 

Author Comment

by:sglee
ID: 40444495
@agx_
I just tried it and it worked great!  That is exactly what I wanted to do.
Thank you very much!
0
 
LVL 52

Expert Comment

by:_agx_
ID: 40444593
Glad it helped.

( I'd thought using href and hrefKey would do it, but CF doesn't allow you to set the URL parameter name, so that doesn't quite cut it.  This is such a common need. You'd think it would be simpler ;-)
0
 

Author Comment

by:sglee
ID: 40444711
I agree and again thank you.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

783 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