Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Make textfield invisible + JIRA 6.0

T I
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.
May 9, 2013

Hi,

I need to make a textfield(custom field) invisible in the "create/edit issue" mask as it provides a plugin with information that users don't need to see. Any idea how to do it in JIRA 6.0?

In JIRA 5.2.x I could use JIRA Toolkit Plugin to add a "Message Custom Field (for edit)" that make the textfield invisible with css.

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
RambanamP
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.
May 12, 2013

add the following code in field description of the specific issuetype field configuration

<script type="text/javascript">
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
	$('#customfield_10837').closest('div.field-group').hide();
});	
});
</script>

T I
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.
May 12, 2013

I put the code in like every description because I wasn't sure if I understood you exactly. Was it ( Issues -> Fields -> Field Configuration -> "Configure" -> MyField "Edit" ) ?

I tested it with JIRA 5.1.8 and 6 and it doesn't work.

T I
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.
May 12, 2013

HTML-Code (field still visible):

<div class="field-group" >
    <label for="customfield_10000">HiddenLinkID</label>
    <input class="textfield text long-field" id="customfield_10000" name="customfield_10000" maxlength="254" value="" type="text">
    <div class="description">
<script type="text/javascript">
jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { $('#customfield_10000').closest('div.field-group').hide(); }); }); </script> </div> </div>

RambanamP
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.
May 12, 2013

if you want to hide the text field for specific issutype issues then you have to add the code on that issuetype field configuration.

another way you can include js in plugin as webresorce , check this

https://answers.atlassian.com/questions/47843/strange-javascript-problem-in-create-screen

T I
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.
May 12, 2013

So, I added a new web-resources:

&lt;web-resource name="create_linked_action_hide" i18n-name-key="create_linked_action_hide.name" key="create_linked_action_hide"&gt;
    &lt;dependency&gt;jira.webresources:global-static&lt;/dependency&gt;
    &lt;description key="create_linked_action_hide.description" /&gt;
    &lt;resource name="hide" type="download" location="/js/hide.js"/&gt;
    &lt;context&gt;atl.general&lt;/context&gt;
  &lt;/web-resource&gt;

hide.js:

jQuery(document).ready(function($) {
	JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
    	$('#customfield_10000').closest('div.field-group').hide();
	});
});

I can still see the field.

T I
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.
May 12, 2013

So, is this code ok? How is this hide.js even triggered? On every event in JIRA?

RambanamP
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.
May 13, 2013

your code looks good and it should work!!!

yes, it will triggered when page loads and on popup, you can check this by giving alerts.

T I
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.
May 13, 2013

Ok it's working, but only if I create an issue in a dialog.

If I open the "Create Issue"-Screen in a new tab I can see the field. Any idea how to hide it there?

T I
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.
May 13, 2013

Ok I used a example from an other question, so it also works while in a new tab.

jQuery(document).ready(function($) {
function hide() {
$('#customfield_10000').closest('div.field-group').hide();
}
hide();
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context) {
  hide();
});
});

RambanamP
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.
May 14, 2013

glad to hear it worked!!!

1 vote
Timothy
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.
May 9, 2013
T I
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.
May 12, 2013

So I need a web-resource in my plugin. I have like 0 JavaScript experience. Could anyone tell me how the JavaScript would look like if I wanted to make a field invisible? And how do I trigger it?

0 votes
Bhushan Nagaraj
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.
May 9, 2013

Hi Tomasz,

Not sure if I understand your requirement correctly. But if you are just looking at hiding a field from the create/edit/view issue screen, you must be removing that field from the screen that your project's screen scheme is using.

T I
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.
May 9, 2013

I write information to this textfield over the url. If I hide it it doesn't exist and therefor I can't write sth to it.

The field needs to be in the mask, but invisible for the user.

TAGS
AUG Leaders

Atlassian Community Events