Since OOH Forms is object oriented, it can be easily customized by
extending the classes that define the element types. In general, you
must make sure your derived class has a constructor and you may
override any of the self_* functions of
of_element. The source for the existing elements is the
best documentation for how to do this properly, but a few general
notes follow.
Display an instance of this element unfrozen. $val is the
$value argument of show_element if there was one;
$which can be used as an index for array valued elements; it is
equal to the number of times show_element has been called
for this element previously. This function must return the number of
hidden tags output.
self_show_frozen($val,$which)
Display an instance of this element frozen. In addition to the
html to show the frozen element, you must output tags for hidden
fields to duplicate the effect of submitting an unfrozen element of
this type. The function must return the number of hidden tags output;
Validate $val for this element. If it is valid, return false,
otherwise return the relevant error string.
self_print_js($ndx_array)
Print out Javascript code to validate this element.
$ndx_array is an array of the indices of the elements to
be validated as used in the Javascript form.element[] array. This is
needed since the extra [] in array valued element names confuses
Javascript.
Set the default value for this element to $val. Usually the
default definition of this function, which just copies $val to
$this→value is all that is needed, but there may be special
cases that need to do something else. See the implementation of the
checkbox element for an example.