cancel
Showing results for 
Search instead for 
Did you mean: 

how to get input fields based on selection

Former Member
0 Kudos

Hi

i have dropdown which cointains 1 to 10 numbers,as soon as we select 2 in dropdown 2 input fields should be displayed.can u please help me in solving this problem

thanks

kishore

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Please give more information on the use case. As you can see from the given answers, the simplicity of the solution depends on the needed degree of flexibility.

Armin

Former Member
0 Kudos

HI,

1:Add one child TransparentContainer to RootContainer with id TransparentContainer1

2:Take one attribute of type integer in context

3:When dropdown selected set the selected value to this attribute like

wdContext.currentcontextElement().set<value>(wdContext.current<DDNode>Element().get<DDValue>);

4:And in do modify view Method, put following code

IWDTransparentContainer tc=(IWDTransparentContainer)view.getElement("TransparentContainer1");

if(tc!=null)

tc.destroyAllChildren();

int number=wdContext.currentContextElement().getNumber();

IWDNodeInfo info=wdContext.getNodeInfo();

if(!(wdContext.isEmpty()))

{

wdContext.getContext().reset(false);

}

for(int i=0;i<number;i++)

{

IWDInputField inp=(IWDInputField)view.createElement(IWDInputField.class,"inp"+i);

info.addAttribute("val"+i,"com.sap.dictionary.double");

inp.bindValue("val"+i);

tc.addChild(inp);

}

Regards

LakshmiNarayana

former_member201361
Active Contributor
0 Kudos

hi,

The Input Fields have to be created dynamically based on the selection of the drop down .

for eg :

If the use selects the Dropdown , the onselect Action is fired .

In the Action ,

get the selected value from the context Attribute .

check using the If Conditional statement.

finally create the inputField in the action.

Note : InputFields cannot be created dynamically in the Action method.

For this we can add the parameter of type View , while creating the action.

or create the InputFields in the WdDomodify method and finally bind the visible property of the inputfield to the Attibute of type Visibility(NONE).

Finally in the action method set the visisbility of the inputField to Visibility.visible.

note : based on the user selection, we have make the inputField to visible.

Thanks abd regards

fazal

0 Kudos

hi,

In onselect action get the selected value and pass that number to the method which creates input fields dynamically

For dynamic proggramming refer following link

/docs/DOC-8061#34 [original link is broken]

Former Member
0 Kudos

Hi,

If they are available as part of the design time based on the selection set the visibility property,

else

based on the selection create ui elements in the wdDomodify method.

place a container and add items to this

dont forget to clear the container.

Regards

Ayyapparaj