DB_Table 1.4.0 released

I have released DB_Table 1.4.0 today. Besides small fixes, there is a new feature about static form elements, and the handling of file form elements was optimized.

Static form elements like ‘header’, ‘static’, ‘submit’ or ‘reset’ can now easily be added to forms generated by DB_Table: you just need define an array called $frm in your extended class (let’s assume that you have instantiated this class in $obj), create a form object (e.g. via $form =& $obj->getForm(), ...) and then call $obj->addStaticFormElements($form);.

The $frm array has a very similar format like the column definition format. The key is the field name and the value is an array with details about the element. There is a special key called ‘before’ in the details array. If it is not given, or is empty (or null) the element will be appended at the end. If it is given, the element is added before the element specified via ‘before’. An example how the $frm array could look like:

var $frm = array(
    'headline' => array(
        'before'        => 'name',
        'qf_type'       => 'header',
        'qf_setvalue'   => 'Headline'),
    'submit'   => array(
        'before'        => null,
        'qf_type'       => 'submit',
        'qf_setvalue'   => 'Save data')

This example assumes that there is an element called ‘name’ in the form. The header element will be placed before this ‘name’ element, and the submit button will be placed at the end of the form.

For columns with 'qf_type' == 'file' there were some optimizations: If the column is marked as required, the ‘uploadedfile’ QF rule is now set instead of the ‘required’ QF rule. In addition, the ‘numeric’ and ‘maxlength’ QF rules are not set anymore (of course, the corresponding checks will still be done before inserting/updating data into the database).

Finally, I have added support for ‘hierselect’ and ‘jscalendar’ QuickForm elements.

Comments are closed.