Behaviours plugin in checkboxes and issue edit screen

JPB June 10, 2014

I have a problem with the behaviours plugin when I'm using it for a field of type checkboxes.

What I'm doing, is, that depending if one especific option of the checkboxes field is selected, I show or hide, and set required or optional another field of type single line text. THIS IS WORKING FINE.

The issue, or the thing that's not working ok, is when I tried to edit the issue that have associated the field. When I click the edit button, the checkboxes that were selected, doesn't show as selected (all the options are blank). What I can see when editing the issue, is that initially the options are selected, but inmidiately, there is like a blink in the form, and the options get blank (like another reload), and if I inspect the element in the browser , I can see that at first the options were checked, (attribute checked="checked").

Another thing I found, is that this problem is generated just by adding or clicking the link "Add serverside script" for this field, what I mean saying this, is that if you add a field of type checkboxes to the behaviors field, and doesn't add a script, the checkboxes work fine, and when I edit the issue, the options values are loaded ok. But if I add a script for this checkboxes field, with just a line of code containing a comment, for example:

//this is a comment

(look that there is not code at all), and try to edit the issue, the options of the checkboxes are no selected, just by adding that line in the script.

Any ideas? I tried a lot to solve this, but not luck.

Question 2: by the way, what methods or javascript functions can I use in this plugin? I have tried to use a lot of java script functions, but they don't work, just a little of them work for me, there's a list or a place where I can find that? thank you.

15 answers

1 accepted

0 votes
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2014

Adding as an answer so this question can be closed.

https://jamieechlin.atlassian.net/browse/JBHV-295

And will be fixed in next release.

0 votes
Terry Beavers November 24, 2015

Sorry to jump in on this post, but I have somewhat of a related question.

I am having issues with getting the behaviours to work on a checkbox field when multiple values are selected, so any help would be gratefully appreciated.

Basically, if the user selects multiple checkboxes including "Revision", the Revision Type field (Single Choice Select List) fails to display.

Could you please review my code and let me know what I am missing?

FormField ProductType = getFieldByName ("Product Type")
FormField RevisionType = getFieldByName ("Revision Type")
String ProductTypeVal = (String) ProductType.getValue()
if (ProductTypeVal == "Revision") {
RevisionType.setHidden(false)
RevisionType.setRequired(true)
}
else {
RevisionType.setHidden(true)
RevisionType.setRequired(false)
}

I have tried using if (ProductTypeVal in "Revision") as well, but still no luck.

 

Thanks for your support,

Terry

Terry Beavers November 24, 2015

Got it! if (ProjectTypeVal.contains("Revision"))

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2014

Matt. 6.3.8 is the version of jira, not the plugin. The current version is 3.0.6, which supercedes 3.0-beta-12. Jhonnatan, thanks, must not have closed the issue.

0 votes
JPB October 22, 2014

I've already verified by myself, and the issue is fixed, thanks.

0 votes
JPB October 22, 2014

Hi Jamie. I have the version 3.0.6 of the script runner, so, it's fixed in this version? Cause this issue https://jamieechlin.atlassian.net/browse/JBHV-295 is still 'in Progress' status.

0 votes
Matt Parks October 22, 2014

According to JBHV-295, version 3.0-beta-9 is affected and the problem is resolved in 3.0-beta-12. Is the fix actually included in 6.3.8?

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2014

I'm not sure what versions that relates to. The current version of jira is 6.3.8. The plugin version with the fix has already been released.

0 votes
Matt Parks October 19, 2014

I'm running into this same issue. It looks like the latest available release is 6.3.0.8, but the problem will be fixed in 12. Is this true? If so, do you know when 12 will be available? Thanks, Matt

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2014

And will be fixed in next release.

0 votes
JPB June 17, 2014

Thank you :)

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2014

Atlassian haven't integrated their AOD instances, you need to create a new account. I created the ticket for you:

https://jamieechlin.atlassian.net/browse/JBHV-295

0 votes
JPB June 10, 2014

I forgot this: the version of the plugin I'm using is 0.5.10. Jira version: 6.1.5

For the ticket, I tried to log in with my atlassian account, but it doesn't work.

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2014

hrm strange... i'll look into it (although not immediately). Thanks for the screenshots.

Ideally could you create a ticket at https://jamieechlin.atlassian.net/browse/JBHV- you can just link back to here.

0 votes
JPB June 10, 2014

Here are the screenshots Jamie.

Image 1

Number 1 shows the custom field of type checkboxes, called Service Type, and whe you select the other option, a new custom field is shown, named Other Service, as you can see in image 2. If you uncheck the other option, the field is hidden again. This is working Ok.

Image 2


Image 3 shows the view of the issue, and you can see there that the Service Type field was saved with 'Staff augmentation' and 'Other' options checked.

Image 3


When I click the Edit button, I can see that the options are selected, as shown in image 4, but in less than a second (was a little hard to take the screenshot :D) I noted that was a little reload and the options selected are no more selected, as shown in image 5. This is the problem I'm having, I need that the options still remaing selected, that's the normal behaviour.

Image 4

Image 5


Image 6 shows that the options were checked initially, this is just by right clicking the element in the form and then click the inspect element option (using chrome).

Image 6


Note: This bad working doesn't depend of the code in the script of the behaviour, as I said before, just by adding a line of comment in the code cause this issue.

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2014

Can you give some version info?

Any chance you could do some screenshots. For example if you take a look at the first screenshot on https://jamieechlin.atlassian.net/browse/JBHV-294, it describes it perfectly, and I don't need to read a lot of text that is a bit difficult to follow.

Suggest an answer

Log in or Sign up to answer