PDA

View Full Version : pass javascript variable to cold fusion


timrande
06-02-2005, 09:50 PM
anyone know if there's a way to pass a javascript variable to cold fusion? or a good article that shows how to do this?

ranjan
06-03-2005, 06:16 AM
coldfusion can populate a javascript variable, the other way round is not quite possible. Why because CF is executed on te server, all CF does is convert code to client side code(HTML/Javascript), before it is sent to the clients machine.

What is it that you want to do?

timrande
06-03-2005, 01:21 PM
I have a list box that populates a textbox based on the selection. This is handled by calling a Javascript function called "update" in the onChange event of the list box. The listbox and textbox are wrapped around a <form> tag. At the bottom of the page I have a submit button in another <form> tag that processes the page. I'm trying to get the value of the textbox into a session variable for display on the next page. The problem is when I submit the form there is no value in the listbox. I tried using preservedata = "yes" but that didnt help.

The bottom line. I need to get this value from the text box to the next page. Having 2 form tags seems to be making it difficult.

ranjan
06-03-2005, 07:00 PM
http://www.webpasties.com/xmlHttpRequest/ ('http://www.webpasties.com/xmlHttpRequest/')

The above tutorial is not for CF, but the concept remains the same for any server language