Jump to content

DB_DataObject_FormBuilder & Hierselects


shazam

Recommended Posts

Hello,

I have been playing around with DB_DataObject_FormBuilder for the past few days & am getting pretty far with it.

Recently, I added in the capability to create automatic hierselects by following instructions on:

[url=http://pear.reversefold.com/dokuwiki/doku.php?id=pear:db_dataobject_formbuilder:beyond_advanced#creating_automatic_hierselects]http://pear.reversefold.com/dokuwiki/doku.php?id=pear:db_dataobject_formbuilder:beyond_advanced#creating_automatic_hierselects [/url]

Works great, however, I am running into a few issues:

[list]
[*]I'd like to be able to control the format of the hierselect fields with an external stylesheet.
[*]I'd like to use selectAddEmpty & linkNewValue properties for each of the select boxes created by hierselect
[/list]

[b]For my first issue[/b], I have tried:

[code]$formbuilder->elementTypeAttributes = array('hierselect'  => array('class' => 'form'));[/code]


In my main script as well as:

[code]var $fb_elementTypeAttributes = array('hierselect'  => array('class' => 'form')); [/code]

In my DataObjects_<TableName> class (i.e. the primary table class generating the form).

Neither seems to work. This methodology seems to work well with all other element types. I am able to get the results I want by modifying the args sent to QuickForm's createElement method:

[code]$hierselect =& HTML_QuickForm::createElement('hierselect', $fb->getFieldName($virtualfield), $desc,'class=form','<br />'); [/code]

I would, however, prefer to approach this in the same manner as other elements (i.e. via elementTypeAttributes).

[b]On my second issue[/b], I am having no luck setting the selectAddEmpty and linkNewValue.  The select fields render with values from the database, but with no values set with selectAddEmptyLabel or linkNewValueText.  This does work find w/ standard select elements.

Here is an example of some of the code I am using in my DataObjects_<TableName> class:

[code]
<?php
var $fb_selectAddEmpty  = array (
  'make','model','classification','po_vendor',
  'depr_type','status','glcode','bu','location'
);

var $fb_selectAddEmptyLabel = "-- Select --";

var $fb_linkNewValue    = array(
  'make','model','classification','po_vendor',
  'glcode','bu','location'
);

var $fb_linkNewValueText = "-- Add New --";

var $fb_linkDisplayLevel = "2";

//used for preGenerateForm() and table() methods

    var $conditionalFields = array(
      'classification' => array(
        'calss1:ref_class1' => array('id'),
        'class2:ref_class2' => array('parent', 'id')
      )
    );
?>
[/code]

Perhaps I am missing some very simple concepts. Any pointers are appreciated.

Thx.

- B
Link to comment
https://forums.phpfreaks.com/topic/33645-db_dataobject_formbuilder-hierselects/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.