Dynamically change field depending on value of parent
Description
Dynamically change fields options by their parent fields.
Note: This plugin requires simplejson!
easy_install simplejson
Bugs/Feature Requests
Existing bugs and feature requests for TracTicketChainedFieldsPlugin are here.
If you have any issues, create a new ticket.
Download
Download the zipped source from here.
Source
You can check out TracTicketChainedFieldsPlugin from here using Subversion, or browse the source with Trac.
Install
You can install this software as normal Trac plugin.
- Uninstall TracTicketTemplate if you have installed before.
- Change to the directory containning setup.py.
- If you want to install this plugin globally, that will install this plugin to the python path:
- python setup.py install
- If you want to install this plugin to trac instance only:
- python setup.py bdist_egg
- copy the generated egg file to the trac instance's plugin directory
cp dist/*.egg /srv/trac/env/plugins
- Config trac.ini:
[components] tcf.* = enabled [tcf] hide_empty_fields = false chained_fields = tcf_brand, tcf_phone, tcf_os or chained_fields = component, tcf_brand, tcf_phone, tcf_os for none tcf_ starting fields.
"hide_empty_fields" is the option which enable "hide fields when there are no supplied options", default is false. See #5638 for more details.
Prerequisite
Example
For example, there are 3 fields: brand, phone, OS. When brand changes, phone field will change it's options to show only phone belongs to that brand. When phone changes, OS field will change too.
- Add 3 custom fields in trac.ini
[ticket-custom] tcf_brand = text tcf_brand.label = Brand tcf_brand.order = 3 tcf_phone = text tcf_phone.label = Phone tcf_phone.order = 4 tcf_os = text tcf_os.label = OS tcf_os.order = 5
- Go to Admin -> Chained Fields, edit the config
{ "tcf_brand": { "Nokia": { "tcf_phone":{ "5800": { "tcf_os":{ "Symbian": {}, "Android": {} } } } }, "SE": { "tcf_phone":{ "": { "tcf_os":{ "": {} } } } }, "Apple": { "tcf_phone":{ "iPhone": { "tcf_os":{ "OS X": {}, "OS": {} } }, "iPhone 3G": { "tcf_os":{ "OS X": {}, "other": {} } } } } } }
Please note:
- If no options for some fields, like "SE" above, you still need supply the full structure, with empty string as keys.
- It supports any fields after [7793].
Snapshot
Recent Changes
[12602] by richard on 02/07/13 07:56:38
Fixed #6872, support multiple sets of chained fields
[12593] by richard on 02/06/13 04:47:59
Fixed #6872, support multiple sets of chained fields
[10234] by richard on 05/27/11 03:36:24
Fixed #8836 remove annoying error messages in log file if no any tcf data defined
[9928] by richard on 03/04/11 04:20:49
Fixed #7764
Author/Contributors
Author: richard
Contributors:
Attachments
- TracTicketChainedFieldsPlugin.png (6.1 kB) - added by richard on 08/07/09 05:51:19.


