question on dynamic fields plugin (show_when_component)

15 views
Skip to first unread message

Fernan Aguero

unread,
Jun 6, 2025, 4:57:47 PMJun 6
to Trac Users
Hi, 

I have a question regarding the Dynamic Fields Plugin: 

Not sure if I'm understanding how it works correctly. We're trying to have the 'New ticket' page show or hide two fields depending on the 'component'. Much as in the configuration examples, but for components. 

However I cannot get this right. 1) I can get fields to be hidden in the 'New ticket' page. 2) But I cannot get them to appear. I was expecting some AJAX update on the same New ticket page, eg. if I change the component from a dropdown menu and it matches the rule in '[ticket custom]' then I  expect a change on the ticket form itself, before I 'Create' or Preview and submit the ticket. 

Examples work for 'show_when_type' and 'show_when_priority' but they don't work for 'show_when_component', as if this option were not implemented in the plugin. Maybe related to this closed ticket: https://trac-hacks.org/ticket/11186

Example:

[ticket-custom]
effort = select
effort.options = low|medium|high
effort.show_when_component = some_component # does not work 
effort.show_when_type = enhancement         # works!
effort.show_when_priority = high            # works!

I've tried to add a comment to #11186 but couldn't (even after the captcha the comment is rejected). So here it goes. Any suggestion? thanks in advance!


--
fernan

// If not controlled, work will flow to the competent ones
    until they submerge -- Charles Boyle //

Jun Omae

unread,
Jun 6, 2025, 8:22:32 PMJun 6
to trac-...@googlegroups.com
On 2025/06/07 5:57, Fernan Aguero wrote:
> Hi, 
>
> I have a question regarding the Dynamic Fields Plugin: 
> https://trac-hacks.org/wiki/DynamicFieldsPlugin#Configuration <https://trac-hacks.org/wiki/DynamicFieldsPlugin#Configuration>
>
> Not sure if I'm understanding how it works correctly. We're trying to have the 'New ticket' page show or hide two fields depending on the 'component'. Much as in the configuration examples, but for components. 
>
> However I cannot get this right. 1) I can get fields to be *hidden *in the 'New ticket' page. 2) But I cannot get them to appear. I was expecting some AJAX update on the same New ticket page, eg. if I change the component from a dropdown menu and it matches the rule in '[ticket custom]' then I  expect a change on the ticket form itself, before I 'Create' or Preview and submit the ticket. 
>
> Examples work for 'show_when_type' and 'show_when_priority' but they don't work for 'show_when_component', as if this option were not implemented in the plugin. Maybe related to this closed ticket: https://trac-hacks.org/ticket/11186 <https://trac-hacks.org/ticket/11186>
>
> *Example:*
>
> [ticket-custom]
> effort = select
> effort.options = low|medium|high
> effort.show_when_component = some_component # does not work 
> effort.show_when_type = enhancement         # works!
> effort.show_when_priority = high            # works!

Works for me.

1. Install Trac 1.6
2. Create a fresh tracenv
3. Install latest of dynfields
4. Add "dynfields.* = enabled" to components section in trac.ini
5. Define the following custom fields in trac.ini
[ticket-custom]
effort = select
effort.options = low|medium|high
effort.show_when_component = component2
6. Visit newticket page; Effort field is not appeared
7. Select "component2" in the component field => Effort field is appeared


> I've tried to add a comment to #11186 but couldn't (even after the captcha the comment is rejected). So here it goes. Any suggestion? thanks in advance!
Please register as new user, otherwise configure username and email in
user's preference panel. Anonymous without user and email user is almost
rejected.


--
Jun Omae <jun...@gmail.com> (大前 潤)
Reply all
Reply to author
Forward
0 new messages