Hi,
I want to make a user customfield readonly on Create Screen of JIRA 5.1.8.
When i am using customfied.disabled=true; Field has become Read-Only
Then on Creating issue, the value of that field is getting cleared.
So i have changed the script to :
AJS.$("#customfield_17802").attr("readonly", true); AJS.$("#customfield_17802").removeClass("editable-field inactive"); AJS.$("#customfield_17802 .icon-edit-sml").remove(); var div = document.getElementById("customfield_17802_container"); var anchorList = div.getElementsByTagName('img'); for(var i = 0; i < anchorList.length; i++) { anchorList[i].setAttribute('style','display:none'); }
With the above script , the field has become Readonly & image for selecting users is also removed.
But the user field is still suggesting(auto-complete feature) usernames which are similar to currently selected user.
ex: My user customfield is Current User Field.
I am logged in as user: jira , & user customfied is readonly .
but if there are user id's with jira1, jira2 & jira3 etc.
Then JIRA is suggesting the other values & user is able to select those values.
I don't want the user to select those values.
Thanks
Kapil
Community moderators have prevented the ability to post new answers.
try with this
jQuery(document).ready( function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e,context) { //add your script here and try }); });
suggest you to load js as a webresource
https://developer.atlassian.com/display/JIRADEV/Web+Resource+Plugin+Module
Hi Rambanam,
I added the script with above Jquery , now the field is not happening to be ReadOnly.
<script type="text/javascript"> jQuery(document).ready( function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e,context) { AJS.$("#customfield_17802").attr("readonly", true); AJS.$("#customfield_17802").removeClass("editable-field inactive"); AJS.$("#customfield_17802 .icon-edit-sml").remove(); var div = document.getElementById("customfield_17802_container"); var anchorList = div.getElementsByTagName('img'); for(var i = 0; i < anchorList.length; i++) { anchorList[i].setAttribute('style','display:none');} }); }); </script>
-Kapil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
to complete this make sure to also redirect any click event
AJS.$(
"#customfield_17802"
).on("click", funtion(e) { e.stopPropagation(); e.preventDefault(); return false});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is great !
UPDATE - After I refined some things
This will insert whatever value you wish and grey out / disable input
You can isolate this to a specific form using unique field configurations.
Just insert this into the description box.
If you still want a note to appear just add it after the script.
<script type="text/javascript">
if (document.getElementById("summary").value == "") {
document.getElementById("summary").value = "Address Change Request for\n";}
{document.getElementById("summary").disabled= true;}
</script>
I tried to hide the box and the entire summary block but ran into issues with the word "Summary" before the box.
<script type="text/javascript">
if (document.getElementById("summary").value == "") {
document.getElementById("summary").value = "Address Change Request for\n";}
{document.getElementById("summary").disabled= true;}
{document.getElementById("summary").style.visibility = "hidden";}
{document.getElementByid("qf-field-summary").display = "none";}
</script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am sorry to report that JIRA is a pain in the ...
Once you attempt to Create the ticket it all comes crumbling down.
If anyone knows how to "trick" that validation into working that would be great.
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.