Changes between Version 1 and Version 2 of HowTos/HowToUseEventCopyToScope

Show
Ignore:
Timestamp:
12/21/09 21:38:07 (16 years ago)
Author:
cfgrok (IP: 64.30.223.5)
Comment:

Update exit events to replace "." with "_"

Legend:

Unmodified
Added
Removed
Modified
  • HowTos/HowToUseEventCopyToScope

    v1 v2  
    88    <cfset foot = event.getValue("foot") /> 
    99    <cfset hand = event.getValue("hand") /> 
    10     <cfset xe.nested = event.getValue("xe.nested") /> 
     10    <cfset xe_nested = event.getValue("xe_nested") /> 
    1111}}} 
    1212 
    13 the end result being that each value: foot,hand,xe.nested is now in the variables scope ready for use in your view. 
     13the end result being that each value: foot,hand,xe_nested is now in the variables scope ready for use in your view. 
    1414 
    1515Here in the labs of Model-Glue, we want to reduce developer excise when possible. The new copyToScope() method can be used to short cut the same process. 
    1616 
    1717{{{ 
    18     <cfset event.copyToScope(variables, "foot,hand,xe.nested") /> 
     18    <cfset event.copyToScope(variables, "foot,hand,xe_nested") /> 
    1919}}} 
    2020 
     
    2727{{{ 
    2828    <cfset defaultArray = ["DefaultForFoot", "DefaultForHand"] /> 
    29     <cfset event.copyToScope(variables, "foot,hand,xe.nested", defaultArray) /> 
     29    <cfset event.copyToScope(variables, "foot,hand,xe_nested", defaultArray) /> 
    3030}}} 
    3131 
    32 Once the function executes, the value of variables.foot is !DefaultForFoot and the value for variables.hand is !DefaultForHand. If no value existed in the event for xe.nested, it will be set to an empty string as per normal when a value is requested from the event that has not been set yet. 
     32Once the function executes, the value of variables.foot is !DefaultForFoot and the value for variables.hand is !DefaultForHand. If no value existed in the event for xe_nested, it will be set to an empty string as per normal when a value is requested from the event that has not been set yet. 
    3333 
    3434Does it only work with the variables scope? 
    3535 
    36 Nope. It will work with any scope you see fit. Session, Server, Application, even a plain ole struct, though I expect the variables scope will be most often used.  
     36Nope. It will work with any scope you see fit. Session, Server, Application, even a plain ol' struct, though I expect the variables scope will be most often used.