cancel
Showing results for 
Search instead for 
Did you mean: 

error while creating input field dynamically

Former Member
0 Kudos

Hi,

I am trying to create and input field using the following code

for (int j=0;j<qForm.getNoOfChoices();j++)

{

IWDInputField text1 =

(IWDInputField)view.createElement(IWDInputField.class , null);

text1.setValue("input");

wdContext.getNodeInfo().addAttribute("input"ij,"ddic:com.sap.dictionary.string");

//text.bindEnabled("input"ij);

rootContainer.addChild(text1);

}

and i am getting the following error

<b>com.sap.tc.webdynpro.progmodel.context.ContextException: Path null does not point to an attribute, but to com.sap.tc.webdynpro.progmodel.generation.DelegatingView@b94ed5</b>

can somebody help me in solving this issue

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The "value" of an InputField is a mandatory bindable property. This means, you must bind it against some context attribute of type "string" or some other primitive type.

Armin

Former Member
0 Kudos

Hi Armin,

I have written the code like this

for (int j=0;j<qForm.getNoOfChoices();j++)

{

IWDInputField text1 =

(IWDInputField)view.createElement(IWDInputField.class , "input"+j);

wdContext.getNodeInfo().addAttribute("input","ddic:com.sap.dictionary.string");

<b>text1.setValue("input");</b>

//text.bindEnabled("input"ij);

rootContainer.addChild(text1);

}

i binded the value property with an attribute.still it is throwing the same exception

any other thoughts...

raja_thangamani
Active Contributor
0 Kudos

Try below code:

for (int j=0;j<qForm.getNoOfChoices();j++)
{
IWDInputField text1 =
(IWDInputField)view.createElement(IWDInputField.class , "input"+j); 
wdContext.getNodeInfo().addAttribute("input"+j,"ddic:com.sap.dictionary.string");
text1.setValue("input");
rootContainer.addChild(text1);
}

Raja T

Former Member
0 Kudos

Replace "text.setValue(...)" by "text.bindValue(<path to context attribute>);

Armin

Former Member
0 Kudos

that solved my problem.

thanks for that.

Answers (0)