I have a multi-line text field (optional). I would like the text (when there is text) to be in displayed in red, which means to surround it with [color:red] <text here> [color] (using square brackets here to avoid rendering :-))
I can probably hack a behaviour that will edit the field value when field changes, but it's really a hack.
Any idea? Any existing solution?
Thanks
Hello,
You can use Java Script for it. But it is not a mantainable solution. Or have a look at plugins. For example, like:
https://marketplace.atlassian.com/apps/1211608/color-custom-fields?hosting=server&tab=overview
The plugin above does not do what I need...
The solution I see is to add a ScriptRunner Behaviour on the field and whenever it changes, add the color coding around it. A really ugly solution...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can not add a colour coding, using ScriptRunner behaviours.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Alexey Matveev If I modify the field in a Behaviour, it might trigger the Behaviour again and then will go into an infinite loop...is that what you mean?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, I mean that there is no methods in behaviour to change a colour for a field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can always set the field value with
def newValue = "{color:red}" + oldFieldValue + "{color}"
customFieldObj.setFormValue(newValue)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you try it? It does not set a colour.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to change the field text renderer to Wiki Style Renderer and then it works. You do that in the field configuration.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok. If it works for you, then you can do it:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Amir, I have server so I can set the renderer. Is it possible to do something like if the value of the field is >= 0 then green, if it is <0 then red? Do you have an example you can give me? Also, where do you put this code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It sounds complicated and you must have ScriptRunner. Also, since it's a long text field, it does not have a single integer value.
What you ca do is this:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot Amir, it works for me.
For more detailed information, have a look this link https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.