Inline editing validation

Hi

I have a field(FieldDest) which can take certain values based on value selected for another field(FieldSource). I can enforce the selection on issue creation by using validators.

However when a user does in-line edit after issue creation, how can I add validation ( cannot add as post function for every transition).

Since I know FeildSource when user is editing FieldDest inline, is there a way I can show only values relevant to current selection of FieldSource. (FieldDest is a custom filed, FieldSource is a JIRA default field like Component).

Please let me know.

Thanks

Abe

4 answers

Hello,

If this can help you, us we are using a script that change a field depending on priority.

After that we disable the field inline editing ONLY for those 2 field, so they are forced to use Create or Edit.

<script type="text/javascript">
var path = window.location.pathname;
if (path.substring(path.lastIndexOf('/') + 1).indexOf('BulkEditDetails.jspa') > -1)
     document.write("\n<H4>ATTENTION<BR><BR>To Bulk Edit Ubi Priority, you must specify Severity & Probability.</H4>");

var S1 = 1
var S2 = 2
var S3 = 3
var Sunset = 0
var P0 = 0
var P1 = 1
var P2 = 2
var P3 = 3
var Punset = 4

function setUnsetValue(priorityUbiField)
{
     priorityUbiField.selectedIndex = 11;
}

var removeCTE = setInterval(function() {

    var priorityField = document.getElementById("priority");
    var priorityUbiField = document.getElementById("customfield_10220");

        if(priorityField.selectedIndex == P0)
        {
            priorityUbiField.selectedIndex = 1;
           
        }
	    else if(priorityField.selectedIndex == P1)
        {
                priorityUbiField.selectedIndex = 2;
        }
	else if(priorityField.selectedIndex == P2)
        {
                priorityUbiField.selectedIndex = 5;

        }
	else if(priorityField.selectedIndex == P3)
        {
                priorityUbiField.selectedIndex = 8;
        }
        else  //Unset
            setUnsetValue(priorityUbiField);

    
    return true;


},500);



var dialog = new AJS.Dialog({width:1200, height:730});
              // adds header for first page
                dialog.addHeader("Ubi Priority");
 
                // add panel Ubi Priority
                dialog.addPanel("Ubi Priority", "<img src='/jira/ubimages/icons/Ubipriority/UPV3/UPV3.PNG' width='869' height='597' longdesc='' />", "panel-body");
                dialog.get("panel:0").setPadding(1);
                // add panel Severity and Prob
                 dialog.addPanel("Severity", "<img src='/jira/ubimages/icons/Ubipriority/SeverityV3/UP3_Bug_Severity_Reminder.png' width='720' height='433'  longdesc='' /> ", "panel-body");
     		  dialog.addPanel("Probability", "<img src='/jira/ubimages/icons/Ubipriority/ProbabilityV3/UP3_Bug_Probability_Reminder.png' width='720' height='526'  longdesc='' /> ", "panel-body");

                dialog.addButton("Cancel", function (dialog) {
                    dialog.hide();
                });


                AJS.$("#ubip-button").click(function() {
                    dialog.gotoPage(0);
                    dialog.gotoPanel(0);
                    dialog.show();
                });
</script>

                    <input id="ubip-button" name="ubip-button" type="button" class="button" value="UbiP Help">


Disabled 1 field for inline editing

Description of the code that was executed before the problem occured
<script type="text/javascript">
var removeCTE = setInterval(function() {
var clickToEditElm = $('[class*="editable-field inactive"][id*="customfield_10100-val"]');

        for (var j=0; j < clickToEditElm.length; j++)
        {
           var thisClickToEditElm = clickToEditElm[j];

            thisClickToEditElm.className = thisClickToEditElm.className.replace("editable-field inactive","editable-field");  
            thisClickToEditElm.title = "";
        }            
   
},500);
</script>

Jobin,

I have similar issue here as well. I have a custom field where I wanted to do a validation of the value during in-line edit based on component field values. For normal "Edit", I do a check on the AJS.$("#component") field in javascript to check the values.

For inline edit, I see the HTML is using a div with id wrap and a span like below and I wanted to get the value in the href (namely the value "Component1"). How do I do with javascript?

<li class="item"><div class="wrap"><strong class="name">Component/s:</strong><span id="components-val" class="value"><span class="shorten" id="components-field"><a href="/jira/browse/PRJB/component/10005" title="Component1 ">Component1</a>, <a href="/jira/browse/PRJB/component/10006" title="Component2 ">Component2</a></span></span></div>



0 vote

Try something like this:

AJS.$("#components-field").find('a:first').attr('href')

Haven't tested it!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

182 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you