cancel
Showing results for 
Search instead for 
Did you mean: 

Get selected value in Dropdown list

Former Member
0 Kudos

Hi guys,

I've created a dropdown list (dropdownbyindex) that has 2 values - yes, no. I've created an event for onSelect where it will check what is the value in the dropdown list that was selected by the user, but not sure how to go about coding it. Anyone noes how to do this? Thanks!

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi,

In onSelect action u write this code.

String ss=wdContext.currentContextElement().getObject();

wdContext.currentContextElement().setText(ss);

getObject() is drop down name.

I am displaying this value in text filed

wdContext.currentContextElement().setText(ss);

Regards,

Sunaina Reddy T

Former Member
0 Kudos

hi.

create action on select event.

n give this code for d selected value in dropdown..

wdContext.current<valueNode>Element().set<value attribute>(wdContext.current<BAPI value Node>Element().get<BAPI Value attribute>);

hpe it hlps

Regards

Khushboo

Former Member
0 Kudos

Hi Zhenmin wang,

Suppose in the Context You have taken the Node name as " DDIndex" and Attribute Name as "Value" then in the Event onSelect you write the below code to access Current DropDownbyIndex Value

Syn :- wdContext.current<Node Name>Element().get<Attribute Name>();

here it will be

wdContext.currentDDIndexElement().getValue();

If you have any more Doubts Reply them Back.

Otherwise Please Close this Thread.

With Regards,

Roop Kumar.

Edited by: Roop kumar Annavarapu on Sep 12, 2008 10:52 AM

Former Member
0 Kudos

Hi

in the oN select action

the code

wdcontext.currentcontextelement.atrributevalue

atrribute value the value that u have bound to the drop down

will always giv u the selected value.

Regards

Edited by: Nikhil Tapkir on Sep 12, 2008 11:00 AM

former_member254270
Participant
0 Kudos

Hi Wang,

Try this code,

Create a node and a value attribute named "Key".and write the following code in wdoinit.

IWDAttributeInfo attr_Info = wdContext.getContext().getRootNodeInfo().getAttribute("key");

ISimpleTypeModifiable isim_Mod = attr_Info.getModifiableSimpleType();

IModifiableSimpleValueSet isval_Svs = isim_Mod.getSVServices().getModifiableSimpleValueSet();

isval_Svs.put("YES","YES");

isval_Svs.put("NO","NO");

Thanks.

Former Member
0 Kudos

hi,

use this to get the selected element,

wdContext.node<NODE>().get<NODE>ElementAt(wdContext.node<NODE>().getLeadSelection()).get<Attribute>();

example is like this

wdContext.nodeDDI().getDDIElementAt(wdContext.nodeDDI().getLeadSelection()).getValue();

regards,

ramesh

Former Member
0 Kudos

Hi zhenmin wang ,

Since you are using you can use the following code sample

wdcontext.currentcontext<node>element.get<attributename>

the current will alwys give you the selected value by user.

or you can do this

wdcontext.node<nodename>.getelemenetat(wdcontext.node<name>.getleadselectoion).get<atributename(;

We can get the current selection lead selection since it ddi , and using that we can find which element belongs to that number.

Sorry for the Typo i have typed in directly without seeing NWDS.

Regards

Pankaj Prasoon