Custom Javascript in custom field

Allen Woo September 4, 2011

Hi,

I tried using the suggestion provided at the below location but using a textfield <255 characters i am unable to preload a message.

http://confluence.atlassian.com/display/JIRA/Displaying+a+Field+Based+on+Another+Field+Selection

What i want to do:

Have the textfield populate a standard turnaround time per project using javascript that can read the current system date. Also if posible make this read only.

I know that the first part of running javascript is possible but is not working for me. What i mean by not working is that when i go to create a new Issue the field appears blank.

Thanks for any suggestions

2 answers

1 vote
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.
March 5, 2013

if you want to make field read only use this

AJS.$("#summary").attr('readonly', true);

0 votes
richie_gee
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2013

Hi Uday,

For the scripts that you are looking for, can you try the below scripts, I have testing on my local machine and it works :)

&lt;script type="text/javascript"&gt;

var Day = new Date();
document.getElementById("customfield_10400").value = Day;

&lt;/script&gt;

And as for your request of making this field uneditable, I would suggest that you try Field Security Plugin or Behaviour plugin, however I have never tested those plugins, just saw the recommendation from the community.

Hope this helps :) and have a great day ahead :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events