Validate_Form_XML.cfm

Fake Sheet History

April 1, 2005 – File created.

May 31, 2005 – Added all documentation concerning multiple call modes.

Calling Modes

The Form Validator can be called in one of four modes. This is to allow for several different FDF[1] interfaces. Each mode is described below with its respective calling syntax:

1.  Standard Mode – This is the most frequently used mode in which a single FDF file is used to call the validator.

Calling Syntax

<cfmodule

template=”/wwwAdmin/Cf_Tags/Validate_Form_XML.cfm”

fdf_url=”<url-of-fdf-file>”>

Attribute Explanation

fdf_url – Used to pass the location of the FDF file to Validate_Form_XML.cfm

2.  Modular Mode – This mode allows for multiple FDF files to be passed to the validator. This is useful when the form is being built on the fly and therefore validation must be built on the fly as well. This is generally more useful whenever there are blocks of fields which can be mapped to blocks of FDF rules where each FDF rules block can be placed in a separate file.

Calling Syntax

<cfmodule

template=”/wwwAdmin/Cf_Tags/Validate_Form_XML.cfm”

fdf_header=”<url-of-header-file>”

fdf_urls=”semicolon-sep-urls-of-fdf-files”>

Attribute Explanation

fdf_header – Used to pass the form and return[2] tag to Validate_Form_XML.cfm.

fdf_urls – Used to pass the multiple locations of the FDF files to Validate_Form_XML.cfm.

3.  Code Mode – This mode is used to pass a string of rule information to the validator without actually storing that information in a file. In other words it allows the caller to create the actual rule or rules on the fly and pass it to the validator from the call itself. Note that, like the Modular Mode, it is still necessary to provide the url to a header file containing the form and return tags.

Calling Syntax

<cfmodule

template=”/wwwAdmin/Cf_Tags/Validate_Form_XML.cfm”

fdf_header=”<url-of-header-file>”

fdf_code=”FDF-style-rules”

Attribute Explanation

fdf_header – Used to pass the form and return tag to Validate_Form_XML.cfm.

fdf_code – Used to pass the FDF-style rules to Validate_Form_XML.cfm.

4.  Modular / Code Mode – This mode is a mixture between Modular Mode and Code Mode. It allows for the caller to pass both a string of FDF-style rule code via the fdf_code attribute, but it also allows for the caller to pass a semicolon separated list of FDF rule files to provide block-level modularity.

Calling Syntax

<cfmodule

template=”/wwwAdmin/Cf_Tags/Validate_Form_XML.cfm”

fdf_header=”<url-of-header-file>”

fdf_code=”FDF-style-rules”

fdf_urls=”semicolon-sep-urls-of-fdf-files”>

Attribute Explanation

fdf_header – Used to pass the form and return tag to Validate_Form_XML.cfm.

fdf_code – Used to pass the FDF-style rules to Validate_Form_XML.cfm.

fdf_urls – Used to pass the multiple locations of the FDF files to Validate_Form_XML.cfm.

…so what you’re saying is…

Mode / When to Use? / Example Call
Standard / If you have just one FDF file then use this mode. This is the most usual case, so when in doubt use this mode. / cfmodule
template=”/wwwAdmin/Cf_Tags/Validate_Form_XML.cfm”
fdf_url=”/ProDev/fdf/fdf_MyFDF.xml”>
Modular / If you are building your form on the fly and need to therefore build the FDF on the fly this is one solution. It is best for when you are building the form using a block of fields at a time. Each corresponding block of rules should be in its own file and called in this mode. / cfmodule
template=”/wwwAdmin/Cf_Tags/Validate_Form_XML.cfm”
fdf_header=”/ProDev/fdf/fdf_MyHeaderFDF.xml”
fdf_urls=”/ProDev/fdf/fdf_MyFirstFDF.xml;/ProDev/fdf/fdf_MySecondFDF.xml”>
Code / If you are building your form on the fly and are building it on a field by field basis and would rather not make a separate file for each rule, then use this mode after creating a list of rules dynamically passing the dynamically created list to the validator. / cfset list_of_rules = “<rule<display>Full Name</display<field>txtFullName</field<type>Char</type<length>30</length</rule>”>
cfmodule
template=”/wwwAdmin/Cf_Tags/Validate_Form_XML.cfm”
fdf_header=”/ProDev/fdf/fdf_MyHeaderFDF.xml”
fdf_code=”#list_of_rules#”>
Modular / Code / If you are building your form on the fly and are building it on a field by field basis as well as in blocks, then use this mode to accomplish a mix of Modular and Code Mode. / cfset list_of_rules = “<rule<display>Full Name</display<field>txtFullName</field<type>Char</type<length>30</length</rule>”>
cfmodule
template=”/wwwAdmin/Cf_Tags/Validate_Form_XML.cfm”
fdf_header=”/ProDev/fdf/fdf_MyHeaderFDF.xml”
fdf_urls=”/ProDev/fdf/fdf_MyFirstFDF.xml;/ProDev/fdf/fdf_MySecondFDF.xml”
fdf_code=”#list_of_rules#”>

[1] See Fake Sheet on Form Definition File (FDF)

[2] For information concerning the form and return tags see Fake Sheet on Form Definition File (FDF)