It's all about the answers!

Ask a question

Fetch selected literal value in enumeration list through script


Amit Girme (1131723) | asked Feb 11 '13, 4:03 a.m.
edited Apr 08 '13, 12:58 p.m. by Ralph Schoon (56.0k23642)
 Hi,

I have created an enumeration list of type radio button. Now i want to fetch the value of the radio button selected, through javascript.

How can i fetch the value of selected radio button(literal) through script?

Thanks in advance.

2 answers



permanent link
Ralph Schoon (56.0k23642) | answered Feb 11 '13, 5:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Amit, please get https://jazz.net/library/article/1093 and go through Lab 5. Especially read the section about what JavaScript can do and can't.

You can access the data using getValue() which returns the enumeration literal as string or getLabel() which returns the display text of the literal as text.

Comments
Ralph Schoon commented Feb 11 '13, 5:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

And make sure not to confuse concepts. You probably created an attribute of type enumeration and you created an editor presentation for that attribute that shows the selected value as radio button.


Amit Girme commented Feb 11 '13, 5:57 a.m.

Hi Ralph,


Thanks for your reply.

i want to retrieve value of only selected literal, so how can i get the selected literal value?


Ralph Schoon commented Feb 11 '13, 6:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The script can only access the values assigned to the attribute - the ones selected. See https://jazz.net/wiki/bin/view/Main/AttributeCustomization or  https://jazz.net/library/article/1093 Lab 5.


permanent link
sayli Boralkar (152) | answered Mar 03 '17, 7:42 a.m.
edited Mar 03 '17, 7:43 a.m.

 hello team,


I created two attribute one is attribute type enumeration having name "task status" below are the task status list:
Un-Assigned (Deafult),
Work In Progress(WIP),
On-Hold,
Completed,
Abandoned,
Rework,
Rework Completed
and another attribute type is timestamp having name "actual start date". now the thing is that whenever user select Task status as "Work in progress(WIP)" then actual start date set by current date and time.

for this I create script using value-set but its not working
My script is:

dojo.provide("org.example.workitems.providers.Actualstartdatescript");

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

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

dojo.declare("org.example.workitems.providers.Actualstartdatescript", null, {

    getValueSet: function(attributeId, workItem, configuration) {
    
var actual_sd=workItem.getValue("actusl");
var TaskStatus=workItem.getValue("task_s");
        if(task_s=="Work In Progress(WIP)")
{
return actual_sd.Date.now();
}
else
{
return "";
}
return actual_sd;
    }
});
})();

I think this code is wrong please correct me.

and also I went through many of the solution but I am confused about how to get one particular value or selected value from enumeration and then assign that to actual start date by script.



thanks in advance
sayli

Your answer


Register or to post your answer.