SebTags 1.0 Documentation: Submit to a CFC Method

Submit to a CFC Method

The cf_sebForm tag can automatically submit form data to an instantiated ColdFusion component.

It will pass each form field in as an argument to the method (note that the sebForm processed fields will be available in arguments scope and not in Form scope within that method; Form scope will only contain the raw data).

For example, to call the "callMethod" method of the "Application.MyComponent" component upon submit, use the following code:

<cf_sebForm
   CFC_Component="#Application.MyComponent#"
   CFC_Method="callMethod"
>
	...
</cf_sebForm>

The cf_sebForm tag will perform client and server side validation before submitting the data to the method.

Passing in Extra Data

To pass additional data to the method, use the "CFC_MethodArgs" attribute which takes a structure of values. Each key of the structure represents and argument in the method. These values will take priority over the form fields themselves.

For example, use the following code to set an argument of "myvar" with a value of "myvalue" to the method:

<cfset sArgs = {myvar="myvalue"}>
<cf_sebForm
   CFC_Component="#Application.MyComponent#"
   CFC_Method="callMethod"
   CFC_MethodArgs="#sArgs#"
>
	...
</cf_sebForm>

Processing Exceptions

To have cf_sebForm catch exceptions from your component method as though they are validation error, use the "CatchErrTypes" attributes. Then cf_sebForm will treat any errors of a type in that list as server-side validation errors.