SebTags 1.0 Documentation: getFieldsStruct()

getFieldsStruct()

If you are passing a ColdFusion component to the the CFC_Component attribute, the tag will look for a "getFieldsStruct" method in that component.

The getFieldsStruct method should return a structure of structures. Every cf_sebField in the form (or cf_sebColumn in the table) will look for a key in the structure matching the dbfield attribute (which defaults to the value of the "name" attribute in cf_sebField). If it finds one, it will use the values of that structure as defaults for the values of the matching attributes.

This allows you to centralize definitions of fields in your components and keep your cf_sebForm/cf_sebTable code very short.

For example, you could have code like the following:

<cf_sebForm CFC_Component="#Application.Employees#" ...>
	<cf_sebField name="FirstName">
	<cf_sebField name="LastName">
	<cf_sebField name="BirthDate">
	<cf_sebField type="Submit/Cancel">
</cf_sebForm>

or:

<cf_sebTable CFC_Component="#Application.Employees#" ...>
	<cf_sebColumn dbfield="FirstName">
	<cf_sebColumn dbfield="LastName">
	<cf_sebColumn dbfield="BirthDate">
</cf_sebTable>

Each of the fields would have attributes that are defined in the getFieldsStruct method.

Taking advantage of global attributes and/or getMetaStruct() could reduce the code even further.

When calling the method, cf_sebForm passes an argument named "transform" with a value of "sebField" and cf_sebTable uses a value of "sebColumn"..