Can JIRA gadget configuration fields be conditionally disabled?

Hey everyone, I’m working on a JIRA gadget and I’m trying to figure out if it’s possible to make one configuration field inactive based on what’s selected in another field. Here’s what I mean:

Let’s say there’s a dropdown called ‘Time Selection’ with options like ‘Now’ and ‘Custom’. If the user picks ‘Now’, I want the ‘Date’ field to become grayed out or unclickable.

Right now, I’ve got it set up so the ‘Date’ field is ignored when ‘Now’ is chosen, but it’s still active. The only way users know it’s being ignored is from the descriptions I’ve written. It would be much better if the field actually became disabled.

Has anyone done something like this before? Is it even possible with JIRA gadgets? I’d really appreciate any tips or pointers on how to make this work. Thanks in advance for your help!

I’ve encountered this limitation in JIRA gadgets before. While native conditional disabling isn’t supported, there’s a potential solution using custom JavaScript. You can manipulate the configuration dialog’s DOM to achieve the desired effect.

Implement a script that listens for changes on your ‘Time Selection’ dropdown. When ‘Now’ is selected, use JavaScript to add a ‘disabled’ attribute to the ‘Date’ field. This approach requires careful implementation and testing across different JIRA versions.

Be aware that this method isn’t officially supported by Atlassian, so it might break with future updates. It’s also worth considering user experience - perhaps adding a visual cue or tooltip to explain why the field is disabled could be helpful.

If you decide to pursue this route, I’d recommend thorough testing and possibly reaching out to Atlassian support for any potential concerns or best practices.

As someone who’s worked extensively with JIRA gadgets, I can tell you that conditional field disabling isn’t natively supported in the gadget configuration UI. It’s a limitation that’s frustrated many developers, myself included.

However, there’s a workaround I’ve used successfully. You can implement custom JavaScript within your gadget to manipulate the DOM of the configuration dialog. This allows you to disable fields based on other selections dynamically.

The tricky part is hooking into the right moment to execute your script. I’ve found that using the ‘postRender’ callback in your gadget descriptor works well. From there, you can add event listeners to your dropdown and toggle the ‘disabled’ attribute on the date field accordingly.

It’s not the most elegant solution, and it requires some careful handling to ensure it works across different JIRA versions, but it gets the job done. Just be prepared for some trial and error during implementation.

hey john, i’ve run into this issue too. unfortunately, jira doesn’t let u disable fields conditionally out of the box. but there’s a workaround - you can use custom JS to manipulate the config dialog. it’s not perfect, but it works. let me know if u want more details on how to set it up