How to make custom field text red?
<script type="text/javascript">
AJS.$("#customfield_11329").attr('style', 'color:red')
</script>
Above code does not work. Any ideas?
In that way it does't work on 5+ jira version, try with this
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { callFunction(); }); callFunction(); function callFunction(){ AJS.$('label[for=customfield_11329]').css({color:'red'}); } }); </script>
Great. It works!!
But only in edit screen, not in view screen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
glad to hear it worked!!
if it to be work on view screen you need to check custom field id on view screen
if my answer helped then vote up and accept as answerd :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Dan27 the above script will work on edit screen too, just you need to replace customfield id(you can get field id by inspecting element)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you
@RambanamP,
This text has no id.. only "title" , and it id inside div that has id.. How can I write it in your code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Dan27 can you share html content of a customfield on edit screen?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try with this
AJS.$('label[for=customfield_11329]').css({'color':'red'}); or AJS.$("#customfield_11329").parent('label').css('color','red');
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does not work!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<script type="text/javascript">
AJS.$("#customfield_11329").parent('label').css('color','red');
</script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
how you tried and whatis the jira version?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you share your code? i tried now it is working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is 5.1.5 version,
Still not working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Rambanam Prasad In which file do I need to edit this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Joe Moreno you no need to edit any files, just add code in accepted Answer in Announcement banner for testing, once it worked as expected then i suggest to add this code as web resource module in a plugin(you will get lot of post on this forum if you need to know how to add it in plugin) Note: don't forgot to change customfield id :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@RambanamP I have similar requirement where I need to change the mandatory field labels in Red. But here I am using ScriptRunner Behavior script and it is not working. Here is my code snippet.
// requiredFields has the list of mandatory fields labels.
for(String field in requiredFields){
field = field.trim()
log.warn("Field ::"+field)
String js = "<script type=\"text/javascript\">\n"+
"jQuery(document).ready(function(\$) {\n"+
"JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {\n"+
"callFunction();\n"+
"});\n"+
"callFunction();\n"+
"function callFunction(){\n"+
"AJS.\$('label[for="+field+"]').css({color:'red'});\n"+
"}\n"+
"});\n"+
"</script>"
log.warn(js)
def FormField f = getFieldByName(field)
f.setLabel(js)
Any help is highly appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<script type="text/javascript">
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
callFunction();
});
callFunction();
function callFunction(){
AJS.$('label[for=customfield_11329]').css({color:'red'});
}
});
</script>
add above code on announcement banner by changing cusotmfield id
am not sure how to include javascript using behavior.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@RambanamP Thank you. This works well for custom fields. Can this be possible for system fields? I want to show system fields also in Red.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes, just you need to change replace customfield id with system field id
<script type="text/javascript">
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
callFunction();
});
callFunction();
function callFunction(){
AJS.$('label[for=summary]').css({color:'red'});
AJS.$('label[for=components]').css({color:'red'});
}
});
</script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@RambanamP I have tried your script and its working fine.
I have a custom field with "*" at the end of the label. Is it possible to make only the "*" in Red color instead of whole text?
Thanks in Advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Mani you need to try something like follows if you want to add red asterisk, if you have already asterisk and want to make red color then use CSS to make it red
AJS.$("#customfield_11300").parent().children('label').append('<span class="aui-icon icon-required"></span>');
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply!
The script is working fine but custom field(version Picker(multiple versions) text is not changing to red color. Need total text to be in red color.
Tried with below script
<script type="text/javascript">
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
callFunction();
});
callFunction();
function callFunction(){
AJS.$('label[for=customfield_11329]').css({color:'red'});
}
});
</script
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you share the HTML content for the custom field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @RambanamP,
I don't see any option to get HTML content. It's a Version Picker(multiple version) custom field not default one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HTML content for CMS TestVsersion/s field
<td id="custom-fields-customfield_11110-name">
<strong>CMS Test Version/s</strong>
<div class="secondary-text description">Specify the version(s) on which the defect has been tested.</div>
</td>
<td id="custom-fields-customfield_11110-type" class="nowrap">
Version Picker (multiple versions)
</td>
<td>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
is the above code from create/transition screen?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi -
Is it possible to change the color of the field values for system fields? I am hoping to change the values for Labels to red.
Anyone have any ideas?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.