SebTags 1.0 Documentation: Global Attributes

Global Attributes

Although the SebTags custom tags are generally well encapsulated, they do have some built in hooks to allow you to set global attributes from outside variable scopes.

The following examples will show different way to set the "skin" attribute of cf_sebForm. Here is the direct way:

<cf_sebForm skin="#request.skin#">
   ...
</cf_sebForm>

Global Request Variables

You can also set the variable for all instances of any tags in the set by using request.cftags.sebtags:

<cfset request.cftags = StructNew()>
<cfset request.cftags.sebtags = StructNew()>
<cfset request.cftags.sebtags.skin = "silver">

This would set the "skin" attribute for any tag in the set that didn't already have the attribute set.

Tag Specific Request Variables

You can use request scope to set an attribute for all instances of just one tag as well (cf_sebForm in this example):

<cfset request.cftags = StructNew()>
<cfset request.cftags.cf_sebForm = StructNew()>
<cfset request.cftags.cf_sebForm.skin = "silver">

Variables Scope for cf_sebForm, cf_sebField and cf_sebTable

The cf_sebForm, cf_sebField and cf_sebTable tags will additionally look in variables scope for a "sebFormAttributes" structure, a "sebFieldAttributess" structure or a "sebTableAttributes" structure respectively:

<cfset sebFormAttributes = StructNew()>
<cfset sebFormAttributes.skin = "silver">

Targetting One Instance of cf_sebForm

If you want to set the attributes for just one instance of cf_sebForm, but you don't want to set the attributes directly, then you can use the request variable with an "id". So, if you have a form with an id of "myform":

<cfset request.cftags = StructNew()>
<cfset request.cftags.cf_sebForm = StructNew()>
<cfset request.cftags.cf_sebForm["myform"] = StructNew()>
<cfset request.cftags.cf_sebForm["myform"].skin = "silver">

Targetting One Instance of cf_sebField

You can also target a specific instance of cf_sebField in variables or request scope.

For example, dealing with a field with a name (or dbfield) attribute of "myfield":

<cfset variables.sebFields = StructNew()>
<cfset variables.sebFields["myfield"] = StructNew()>
<cfset variables.sebFields["myfield"].Label = "My Label">

OR:

<cfset request.cftags = StructNew()>
<cfset request.cftags.cf_sebField = StructNew()>
<cfset request.cftags.cf_sebField["myfield"] = StructNew()>
<cfset request.cftags.cf_sebField["myfield"].Label = "My Label">

Priority

The attribute values have the following priorities:

  1. Direct ()
  2. Variables Scope (sebFormAttributes.skin = "silver")
  3. Request with ID (request.cftags.cf_sebForm["myform"].skin = "silver")
  4. Tag Specific Request (request.cftags.cf_sebForm.skin = "silver")
  5. General Request (request.cftags.sebtags.skin = "silver")
  6. Attribute Defaults