This section describes the (object-orientated) API VCV offers to you as
web programmer. VCV implementations have to define this API.
Object-orientated VCV implementations can define the API as methods,
declared for objects of a class named
VCV, while procedural ones need
to declare some global variables, e.g. the option table; they should not
use an object-like handle that is passed as additional function
The following subsections and function declarations are written using a kind of ``pseudo-code'' for describing which data types the functions expect. There are this data types and conventions:
handlein their name are treated as references to callback functions. This may also be a function pointer.
The function here initializes the VCV framework; in object-orientated
terminology it can be seen as a constructor, so its name may also be
same as the class is named to (for C++, Java ...) or may have a special
__construct for PHP 5.
This function creates and initializes a new VCV object; initialization means parsing the web form or form definition file into a handy data structur.
VCV initVCV(const string formdef)
The return value is a VCV object. If this function is implemented as an object constructor, it may not return a value.
The function in this subsection registers a callback handler that is triggered when the clicks a certain submit button on the web form. See Submit Buttons in the xhtml-tags manpage for details.
This function registers the callback handler
callbackHandler for the
HTML submit button
btnName. It is called when the button's value is
registerButtonAction(const string btnName, const string btnValue, callbackHandler)
btnNamehas to have if
callbackHandlershould be called.
boolean callbackHandler(& Form)
The functions in this section register new VCV content types for type-checking submitted data. For more about VCVs content classes see the vcv-classes manpage.
This function registers a new type that is validated against a Perl Regular Expression.
registerClassAsRegExp(const string className, regex pRegExp)
This function registers a new type that is validated by a user defined sub-routine.
registerClassUsingValidator(const string className, validatorHandle)
boolean validatorHandle(const string toCheck, string& out)
toCheck is the incoming data, provided by VCV and
out is a
reference to an array field where the validated and converted (if valid)
data is stored; this array is provided by the VCV Form object.
The functions in this subsection are used for getting and setting VCV options.
This function returns the value of the specified VCV option as string or an undefined value if there is no such option set.
string getVCVOption(const string optName)
This function sets a specific VCV option. It is equivalent to the vcv:option tag.
setVCVOption(const string optName, const optValue)
optName. Its default type is string, so that no VCV implementation should have any problems declaring this function. VCV implementations may accept other types, too, e.g. boolean values.
This function validates the submitted information against the requirements collected by initVCV().
The return value is
true if the submitted data is valid,
This document: $Id: api.pod,v 1.2 2005/09/02 16:05:27 robertbienert Exp $
See http://vcv.sourceforge.net/spec/ for the latest revision.