It's all about the answers!

Ask a question

Change an attribute input field value automatically by event


Liney Reis (139) | asked Oct 09 '12, 7:05 p.m.

I need to reset an attribute input field automatically by changing other input field (value set picker).

Is it possible using dojoattachevent onchange?

How can I do that?

Thanks in Advance!

2 answers



permanent link
Ralph Schoon (63.1k33645) | answered Oct 10 '12, 2:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I would rather look into https://jazz.net/wiki/bin/view/Main/AttributeCustomization and https://jazz.net/library/article/537/ and try out if you can do that using the providers or Java script.
If so it would work in the Web UI as well as in the Eclipse UI.

Comments
Liney Reis commented Oct 15 '12, 3:13 p.m.

I´ve readed the articles, but still looking for a way to clean the fields dinamically by changing other input field.


permanent link
Ralph Schoon (63.1k33645) | answered Oct 16 '12, 6:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Oct 16 '12, 6:58 a.m.
Liney, I have thought about it some more and I see no real option to do that using scripts. Sorry for misleading you. As far as I can tell, there are only the following options to change an attribute value using scripts:

  • Default value provider
  • Calculated value provider.

Default value provider only sets the first time.

You could potentially use a calculated value provider to clear an attribute. Unfortunately I see no way how to distinguish the newly entered value from the old value that got cleared away. As long as the other attribute values are telling to "clear" the value it gets cleared, no matter what you enter. This would not be an issue if you could put a "valid" value on the new attribute value, because that could override the clearing. You could potentially enhance the code below.

I don't find this very easy and I would rather use a precondition to do this. See the RTC Extensions Workshop https://jazz.net/library/article/1000 (follow up action) and examples such as https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ or others you can find in the internet.

Maybe I am missing something here. If others have better solutions, I would be happy to see them.

dojo.provide("com.ibm.js.providers.script.ClearOnValueCalculated");

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
    var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;

    dojo.declare("com.ibm.js.providers.script.ClearOnValueCalculated", null, {

        getValue : function(attributeId, workItem, configuration) {
            console.log("ClearOnValueCalculated - Start");

            try {
                var attributeValue ="";
                var otherAttributeLabel = "";
               
                console.log("getValue");
                attributeValue = workItem.getValue(attributeId);
                console.log("getLabel");
                otherAttributeLabel = workItem.getLabel(WorkItemAttributes.SEVERITY);
                console.log("Severity " + otherAttributeLabel);
                if (otherAttributeLabel == "Blocker") {
                    console.log("Clear");
                    return "";
                }
                console.log("Old");
                return attributeValue;
            } catch (e) {
                console.log("Exception:" + e.name + " message " + e.name +" " + e.toString());
            }
            return"";
        }
    });
})();

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.