Hi, Doug...
I don't know about the CFStoredProc part, but
I would do it something like this:
- run a query to return a list of the record numbers you want to click
and display the record numbers (or person's name with ID attached)
- display the record numbers with an id for each so jQuery can use
the id to determine which record number is clicked
- once a record number is clicked, use a jQuery ajax call to a component
method which runs a query and retrieves the record information
- at this point, you have a couple of options to get the information from
the record to the calling page for display:
1. You can use cfSaveContent in the component method and write the
CFML and HTML needed to create the page content, save the
content
to a variable, return the variable value in a struct to the
calling
and then use jQuery to append the variable values onto the
calling page
2. Or you can just take the query values and assign them to a
struct and
return the struct value to the jQuery function and use
Javascript
code (such as out.push syntax) to insert the new CFML/HTML into
the
calling page
I prefer, usually, to put the CFML and HTML into the variable as in
possibility 1
above using cfSaveContent. That allows me to use CF's syntax to create the
page
content, which is an easier method for me, but I can use CF to jQuery to
modify
the page content.
You don't need to use a CFForm or any form to make this work. Once you have
the record numbers on your page with a link on each with an ID that jQuery
can work with, you can use jQuery's AJAX functions to send and receive data
back from a cfcomponent method and use jQuery to add the new record
information
to the right side of your page.
You can specify the data format for the returned data from the component
method I the URL for the component and method. For example:
../components/records.cfm?method=mGetRecord&returnFormat=json
I know this seems broad, but that's just an overview.
If you need help coding a solution, I'll be glad to help you work something
out. I use CF and jQuery practically every day, especially using jQuery's
AJAX functionality.
Here's a sample of how this might look on the page:
Ben Forta Name: Ben Forta
Ray Camden Hobbies: Checkers, Backgammon
Doug Ford Profession: CF Programmer, Adobe CF
Evangelist
When you click on a name on the left, the info on the right fades out,
is retrieved and the new information is displayed via AJAX on the right.
(links on all the names above, such as:
<a id="recordNumber-1" href="">Ben Forta</a>
<a id="recordNumber-2" href="">Ray Camden</a>
<a id="recordNumber-3" href="">Doug Ford</a>
You could use jQuery to change the record name, such as "Doug Ford" to
the color red when it is the record displayed. Quite a few options.
Let me know what questions you have...
It's late (1:17am!) and I'm tired from softball this evening,
so I hope this makes sense.
hth,
Rick
-----Original Message-----
From: Doug Ford [mailto:[email protected]]
Sent: Tuesday, April 06, 2010 5:31 PM
To: cf-talk
Subject: CF - jQuery - Javascript
Hi folks -
I have a question that could probably fall into multiple categories on HOF,
but I thought I would start with my default list! ;-)
Anyway, here's my story:
I have a web page split in half.
Left half has different records being displayed.
Right half has a form, which populates a set of tables, and then that
information appears on the left half. This process is working.
The current challenge is this:
The Left side has different records appearing on it as mentioned, it's not
an iFrame BTW - the records have an ID number. The user would click on the
ID number, and then form on the Right gets populated with that record's
details.
What I am hoping to do is pass the ID number using jQuery to a CF form, that
gets the data from a query, passes the data back, and then that data is told
to go into the proper fields to be displayed.
Here are my questions/statements:
I can send information to the CFM page with the ID on it.
1) When I perform the CFSTOREDPROC and assign it to a resulting variable.
What do I have to do to, or what commands are needed so that it can be taken
back to the original calling page.
2) Once the data comes back, what format is the data in?
If anybody wants to provide any other details that I could be overlooking, I
would appreciate it.
Thanks,
Doug
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332685
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm