cancel
Showing results for 
Search instead for 
Did you mean: 

create an input field dynamically

Former Member
0 Kudos
50

hi,

i want to create an input field in my domodifyview() method.

can anyone plz suggest the necessary coding?

thanx.

regards,

ankita

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

IWDInputField inputField = (IWDInputField) view.createElement(IWDInputField.class, "<ID for your input>")

inputField.bindValue("<Attribute to which this should be bound>");

and finally add this to a container

Ex:

IWDTransparentContainer container = (IWDTransparentContainer)view.getElement("<RootUIElementContainer>");

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

IWDAttributeInfo iWDInfo = (IWDAttributeInfo) wdContext.getNodeInfo().getAttribute("<Your Attribute Name");

input.bindValue(iWDInfo.getName());

container.addChild(input);

Regards

Ayyapparaj

Former Member
0 Kudos

hi,

thanx for the help .

i tried it in the do modify view() method.

bt on running the application i get null pointer exception.

can u tell where i went wrong?

regards,

ankita

Former Member
0 Kudos

Hi,

Can you post the code from your WDmodify.

Either you are accesing the continer which doesnot exist. or else trying to bind to a attribute which is not present.....

Regards

Ayyapparaj

Former Member
0 Kudos

hi,

actually im binding it to an attribute which isnt present.

i wrote the follwing code after creating the context node:

node.addAttribute("HomePage","com.sap.dictionary.string");

hw can i create an attribute dynamically?

plz help.

thanx.

regards,

ankita

Edited by: Ankita Padhi on Dec 27, 2007 10:16 AM

Former Member
0 Kudos

Hi,

To Create an attribute dynamically

wdContext.getNodeInfo().addAttribute("<name>", "<dataType>");

Ex:

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

Regards

Ayyapparaj

Former Member
0 Kudos

hi,

thanx for the help.

bt i hv a new problem.

when i click on my SAVE btn, it gives the error as : unable to add label and the input field that i hv created.

can u help?

thanx.

regards,

ankita

Former Member
0 Kudos

Hi,

You have to write the code for creation of UI elements in side the condition

If(firstTime)

{

// Your Code for UI Creation

}

Else every round trip it will try to create the UI comp.

Regards

Ayyapparaj

Former Member
0 Kudos

hi Ayyapparaj,

thanks a lot.

regards,

ankita

Answers (0)