
December 23rd, 2011, 04:53 PM
|
Registered User
|
|
Join Date: Dec 2011
Posts: 1
Time spent in forums: 7 m 29 sec
Reputation Power: 0
|
|
Set session variable in Iframe to be used in parent
Do anyone know of a way to update a coldfusion session variable in a iframe?
I have sessionmanagement="true" and I would like to run a iframe that updates a session variable based on a select statement for the year of a vehicle.
When I run the iframe the the session variable is passed as a url variable and this appears to works with out a hitch. In the frame page I am setting the session variable from the url variable passed to the iframe, however when the page returns to the parent the the session is not set ??
I am trying to make a "year make model" utility so that I can include it anywhere on my auto parts site oehq.com where the user can reset the vehicle ID to a new "year make model".
Thanks for the help
Sample Code:
<!---html select statement with iframe call--->
<tr>
<td class="reg" align="left"> <strong>Year</strong></td>
<td>
<cfoutput>
<select name="gYEARID" onchange="window.open(this.options[this.selectedIndex].value,'myIFrame')" >
<cfif session.sYear eq 0>
<option value="">-- Select Year --</option>
</cfif>
<cfloop query="getyear">
<cfif #session.sYear# eq #trim(getyear.autoyear)# >
<option value="getymm.cfm?gyear=#trim(getyear.autoyear)#"selected>#autoyear#</option>
<cfelse>
<option value="getymm.cfm?gyear=#trim(getyear.autoyear)#" >#autoyear#</option>
</cfif>
</cfloop>
</select>
</cfoutput>
<iframe src="getymm.cfm?gyear=0" name="myIFrame" id="value" width="800" height="300">
You can't see this because your browser does not support iframes.
</iframe>
<cfoutput><h1> session.syear = #session.syear#</h1> </cfoutput>
</td>
</tr>
<!--- iframe page = getymm.cfm--->
<cfparam name="url.gyear" default="0">
<cfset session.syear = #url.gyear#>
<cfdump var="#url#">
<cfflush>
<cfoutput>
session.syear = #session.syear# <br>
</cfoutput>
|