dynamically populating cfwindow

I have some code that gets data from a database. I want to create a link that when the user click on it for more information to change the cfwindow contents dynamically based on the record selected. in the ColdFusion.window.show method, you can't pass in parameters. Any ideas?
asaworkerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SidFishesCommented:
this should give you an idea


<cfajaximport tags="cfwindow"></cfajaximport>
 
<script>
function showWin(){
 
	var d = new Date();
	var wid = d.getMinutes()+d.getSeconds(); 		
 
	ColdFusion.Window.create("myWindow"+wid, showWin.arguments[0], "msgWindow.cfm?msg=" + showWin.arguments[1], {height:400,width:400,modal:true,closable:true, draggable:false,resizable:false,center:true,initshow:true,refreshOnShow:true});
	ColdFusion.objectCache["myWindow"+wid] = null;	
	}
</script>
 
<button onclick="showWin('Apples', 'Granny Smith');">Apples</button>
<button onclick="showWin('Oranges', 'Valencia');">Oranges</button>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SidFishesCommented:
btw, we use the wid variables and clear objectCache to prevent caching issues with the window once it is closed and reopened

oh... and the msWindow.cfm file code is simply

<cfoutput>
<span style="font-size:.8em;font-family:tahoma;">
      #url.msg#
</span>
</cfoutput>

you could also put query code in here to provide info based on an ID passed in the url.msg rather than trying to pass it all in the url variable
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

azadisaryevCommented:
just call ColdFusion.navigate() function before ColdFusion.Window.show() function.

Azadi
0
azadisaryevCommented:
i think i need to elaborate a bit more:

say, your db output is like this:

<a href="##" onclick="showDetails(#ID#)">#Name#</a>

each db record has a unique id that you pass to showDetails() js function, which in turn looks like this:

showDetails = function(id){
  ColdFusion.navigate('someurl.cfm?id='+id, 'detailsWindow');
  ColdFusion.Window.show('detailsWindow');
}

stick that function in a <script> block in the HEAD section of your page.

then all you need to do is add a <cfwindow> tag at the bottom of your page with name='detailsWindow' and initshow="false" and NO source attribute (any other attributes can be whatever you need them to be)

that's all.

Azadi
0
asaworkerAuthor Commented:
Thats everyone. This is eactly what I wa slooking for. azadisaryev, that is how I did do it, but I needed to chnage bthe title of the cfwindow dynamically too like what SidFishes said. I also have more than one window to open on each page.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.