coldfusion Common scopes


Mostly you're probably working with these scopes:

  • Variables scope is the scope where all variables are assigned to when nothing else is intentionally declared (like the window scope in JavaScript).
  • Form scope When you send a form to your server, all the form fields which can be identified (by setting the name/id property) are accessible in this scope for further server-side processing.
  • URL scope All url query params are stored in that scope
  • this scope Inside a component the this refers to the component itself
  • local scope Variables declared inside a function using the local statement are encapsulated and only accessible inside that specific function (this is made to avoid pollution of other sopes)
  • Arguments scope Arguments passed to a function inside a component declared by the cfargument tag are accessible with that scope