Option Trim

cYu - June 17, 2008 - 19:48

Trims options out of CCK select boxes.

The 2.0 version for D6 works with the following field types (all select widgets):
Text
Number (integer, float, decimal)
Nodereference
Userreference
Rolereference

This module can be used for a few different reasons:

1. You are using a reference field such as node_reference, user_reference, or role_reference and have options that you'd like to trim out of the list, but don't want to write a custom module to form alter out those options.

2. You want to dynamically trim options out of a select list based on the option chosen in a parent select box, achieving a dynamic dependent dropdown effect. The difference in how this works compared to other efforts is that the select box to be trimmed must start out with all possible options, then through an admin interface you can select how these will be dynamically trimmed out based on the selected option of a different select box. With javascript disabled all options will always show but nodeapi validation will still kick in so that only valid options will be submitted.

The 2.0 branch adds a couple other use cases.

3. You have a select list which you'd like to remove values from, but you still want old nodes that had those values to appear with them. By selecting the "Persist values" checkbox on a trim you can trim out these values from new nodes but leave them if they were selected on an old node.

4. You want to trim a select box based on the role of the currently logged in user. Choose Dependent on: '-Logged in user's role' to perform these type of trims.

Administration is done by first selecting the content type which contains the field to be trimmed. You then define whether it is a dependent trim or not. For a non-dependent trim you need only select the default values. For a dependent trim you select default values (which will show regardless of selected option of parent) as well as any values to show for individual options of the parent select.

Releases

Official releasesDateSizeLinksStatus
6.x-2.12009-Mar-1315.8 KBRecommended for 6.xThis is currently the recommended release for 6.x.
5.x-1.02008-Nov-2114.2 KBRecommended for 5.xThis is currently the recommended release for 5.x.
Development snapshotsDateSizeLinksStatus
6.x-2.x-dev2009-Jun-1616.06 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.


 
 

Drupal is a registered trademark of Dries Buytaert.