Use ScriptRunner to set focus on a given field when using a behaviour

Kenneth D _Kent_ Mahan August 24, 2022

When creating issues/tickets in Jira, we are currently using ScriptRunner Behaviours to show/hide fields based on a dropdown field, as well as setting components based on that same dropdown field.  The show/hide & components part is working exactly as we want it to.  However, Jira leaves the component field as the focus on the screen, & leaves the cursor in the component field ready to enter additional components.  If the fields to be displayed are more than can be displayed on the screen, it focuses the screen on the components field and the user has to scroll back to the top to complete the form.  How do I set the focus back to another field, & make the cursor active in that field?  Ideally, I would want the screen to re-focus on the summary field, & make the cursor active back in that field.

1 answer

0 votes
Roland Gersei January 26, 2024

Hi

I found a workaround for this problem.

In the original behaviour i set the focused field to read only, then i created another behaviour in which the read only set is false.

With this solution the focus is set back to original.

Suggest an answer

Log in or Sign up to answer