Page 1 of 1

conditional valuelist problem

PostPosted: Tue Nov 03, 2009 11:44 am
by ststoddard
Hi,

I am using the valuelist function in delegate classes to generate valuelists that are conditional to the related record from whence one is entering data.

This works great for data entry. But it wreaks havoc on find and update functions. Is there a way to limit the conditional value list to only function when looking at a 'new related record' form, or something to that effect?

Thanks.

PostPosted: Tue Nov 03, 2009 5:54 pm
by shannah
Code: Select all
function valuelist__mylist(){
    $query =& Dataface_Application::getInstance()->getQuery();
    if ( $query['-action'] == 'new' or $query['-action'] == 'new_related_record' or $query['-action'] == 'edit' ){

         // do my filtered list
    } else {

        // do the full list.
    }
}



There are other ways to achieve what you want here, such as using javascript to filter the values instead of doing at the valuelist level; or creating a grafted field via the __sql__ directive in the fields.ini file that contains the field value and use that as your show piece in list view.

There are probably 10 other ways also.