In you submit handler template, apply the FORM.dd_year value to a 
SESSION scope variable. This keeps that variable uniquer per user, and 
persists it throughout their browsing session. The other option is to 
set it to the COOKIE scope, so that it might be available for that user 
across sessions. Remember to param/cfparam the variable on any page it 
might be used, so that you can apply a default if the value has not 
explicitly been set yet.

<cfparam type="numeric" name="COOKIE.birthYear" default="0" />

<select name="dd_year">
<cfloop from="2000" to="2003" index="REQUEST.i">
<option value="#REQUEST.i#"<cfif COOKIE.birthYear eq REQUEST.i> 
selected="selected"</cfif>>#REQUEST.i#</option>
</cfloop>
</select>

Steve 'Cutter' Blades
Adobe Community Professional
Adobe Certified Expert
Advanced Macromedia ColdFusion MX 7 Developer
____________
http://cutterscrossing.com


Co-Author "Learning Ext JS 3.2" Packt Publishing 2010
https://www.packtpub.com/learning-ext-js-3-2-for-building-dynamic-desktop-style-user-interfaces/book

"The best way to predict the future is to help create it"


On 9/18/2011 2:04 PM, fun and learning wrote:
> Hi All-
>
> I have a question on variable scopes. I have the following scenario.
>
> Suppose I have a dropdown as below with some tax years:
>
> <form name="frm" method="post" action="results.cfm">
>   <select name="dd_year">
>       <option value="2000">2000</option>
>       <option value="2001">2001</option>
>       <option value="2002">2002</option>
>       <option value="2003">2003</option>
>   </select>
>
>   <input type="submit" value="Submit" name="sbtbutton" />
>
> </form>
>
> So once the user logins and selects a year from the drop down, upon clicking 
> the submit button, the year value should be available across all pages. What 
> is the best way to store the value? I mean in which scope?
>
> Thanks.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:347503
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to