AJAX

Whilst working various OpenSource projects I have created various functions for constructing Backbase (client edition) code through a simple PHP class (still in development).

One of the most useful functions is combobox creation.

public function combobox($name, $values_array, $default=null, $size=300, $required=false){
    $req_bxml = ($required)? " b:required=\"true\"" : "";
    $bxml  = '<b:combobox b:width="'. $size .'px" b:name="'. $name .'" b:text="'. $default .'"'. $req_bxml .'>';
    foreach ($values_array as $value) {
        $bxml .= '<b:combo-option b:value="'. $value['value'] .'">'. $value['name'] .'</b:combo-option>';
    }
    $bxml .= '</b:combobox>';
    return $bxml;
}
 

With this code you simply pass it a name followed by an array of values. The other options allow you to define a "selected" value, then the size of the combobox and whether or not it is required. The required functionality is not yet implemented into the Backbase control so best ignore it for the time being.

pdavies | AJAX | 18 June, 9:34am | Comment on this

Category Cloud

Link Dump Tag Cloud