CCK Allowed Values PHP code referencing other input fields?

fyehoo - June 29, 2009 - 20:13

I have been trying to find the best way to create a set of dependent dropdowns (selections in one field determine the allowed values for another field).

The Allowed Values PHP Code snippet is the obvious place to do this but I have not found a good way to reference other field values from within this "hook" in CCK.

The following code snippet example is close

http://drupal.org/node/492288

but it does not give me a way to make things dependent on other fields in the form.

It then references a tutorial at http://blue.live4all.co.il/~mooffie/cms/node/17 which creates a workaround to get to the context of other input fields, but this module (cck_context) does not seem to work with Drupal 6 even though at one time it seemed to be a best practice.

I have looked at Hierarchical Select (need this to work with straight user-created content not taxonomies or flat lists), Option Trim (not dynamic enough and the manual assignment of selections makes it unscalable), Fixed Data Dropdowns, ActiveSelect (why no Drupal 6?) and a number of various forums posts describing how to do this, but these all seem to be very extensive solutions to a simple problem. IE I already have a place to put PHP Code to do what I want, but I just do not know how to reference the right data in the code snippet.

It seems really odious to have to write a new module just to make the CCK Allowed Values PHP code be able to reference the current state of other input fields (okay the tutorial above does just that but the cck_context module simply provides a way to pass that state around, it is not a complete replacement input module).

Which leads me to the actual question being asked. It is a minimalist question, which I think fits the CCK philosophy. Note I did not ask how to do dependent dropdowns, I asked how to reference the context of other input fields from the CCK Allowed Values PHP code in Drupal 6.

subscribing

felipe - July 25, 2009 - 22:44

subscribing

 
 

Drupal is a registered trademark of Dries Buytaert.