cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown field

Former Member
0 Kudos

Hi,

I have to use a drop down in a NWDS project, there are two drop downs, one for country names and the other one for their respective states, these values are save in back end. Is it possible to get a drop down of these by using the back end data.

Regards Umang

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Yes its possible to populate dropdown using back end data.For this u need to convert a string type context to simple type dynamically.Create a drop down by key and bind it to that string type context.

suppose u create a context say ctx_string.

and then whereevr u r fetching data from back end write the below code just after that.



 IWDAttributeInfo attr_a_Schemas = wdContext.getContext().getRootNodeInfo().getAttribute(" ctx_string
")
ISimpleTypeModifiable isim_a_schemas = attr_a_Schemas.getModifiableSimpleType();
IModifiableSimpleValueSet isval_a_schemas = isim_a_schemas.getSVServices().getModifiableSimpleValueSet();
isval_a_schemas.clear();
for(int i = 0; i < someLength; i++)//somelength equals to ur populated node size in which ur attribute is there which u want to display as dropdown
{
//set ur nodes lead selection to i value.
  isval_a_schemas.put("KEY"+i,"DESCRIPTION");//instead of key and description use ur attribute which u want to bind to drop down.
}

and to get the selected value from dropdown.

just write


wdContext.currentcontextelement.getCtx_string();

Regards

Surender Dahiya