cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the values from the input field of a table

Former Member
0 Kudos

Hello Friends

I am having table having one column as InputField and rest are the textview fields

I input the data and click the button that will add them to a node.

But what is happening is it is adding the current value to all the fields replacing other filelds.

Like suppose I am having 3 rows

In column I input 10

In column 2 input 20

In column 3 input 30

Now it is setting the value 30 to all the 3 fields.

Can any one tell me the code to set 10, 20 and 30 as different value in a node as entered by me.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Hope the cardinality of your node is ..n

TestNode

Element1

Element2

Element3

If the node structure is as above

on click of the add button

call the method wdContext.nodeTestNode().createandaddelements

then start entering values to all the input fields

Regards

Ayyapparaj

Former Member
0 Kudos

I am getting the same error ... please help

arun_srinivasan
Contributor
0 Kudos

Hi

i am your scernario as follows

Context

TN_node (value node of cardinality 0:N)

val1 (value attribute under value node)

val2 (value attribute under value node)

i have binded Tn_node to table and val1 is textview and val2 is inputfield

public void wdDoInit()

{

//@@begin wdDoInit()

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

{

IPrivateTestView.ITN_nodeElement ele=wdContext.nodeTN_node().createTN_nodeElement();

wdContext.nodeTN_node().addElement(ele);

ele.setVa1("val"+i);

}

//@@end

}

i have a button go in which printing all the values

public void onActionGo(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionGo(ServerEvent)

for(int j=0;j<wdContext.nodeTN_node().size();j++)

{

//IPrivateTestView.ITN_nodeElement

IPrivateTestView.ITN_nodeElement ele=wdContext.nodeTN_node().getTN_nodeElementAt(j);

wdComponentAPI.getMessageManager().reportSuccess("-----"+ele.getVa1());

wdComponentAPI.getMessageManager().reportSuccess("-----"+ele.getVa2());

}

Hope this helps,

If your problem is not solved please post your code like this

Thanks and Regards,

Arun

Answers (5)

Answers (5)

former_member1242340
Participant
0 Kudos

Hello Friends

I am having table having one column as InputField and rest are the textview fields

I input the data and click the button that will add them to a node.

But what is happening is it is adding the current value to all the fields replacing other filelds.

Like suppose I am having 3 rows

In column I input 10

In column 2 input 20

In column 3 input 30

Now it is setting the value 30 to all the 3 fields.

Can any one tell me the code to set 10, 20 and 30 as different value in a node as entered by me.

hai vivek ,

will u plz send the code that is adding all 3 fields as same i need that plz help me out

Former Member
0 Kudos

Hi Vivek,

Just create and add an element at the time of clicking the add button

ie. Inside the button action, paste the following code

IPrivet<view>.I<Table>Node tNode=wdContext.node<Table>();

IPrivet<view>.I<Table>Element tEl=tNode.create<Table>Element();

tNode.addElement(tEl);

Regards

Fahad Hamsa

Former Member
0 Kudos

Hi,

Check the cardinality of the node which has the attribute, for which the input field has been bound to.It must be o..n.

Regards,

Prabhakar

Former Member
0 Kudos

Hi,

What is the context structure of your table node ?

Also specify the mapping of inputfield to the context attribute ?

I have created the context attribute for the InputField under the table node (cardinality 0..n, selection 0..n,singleton true) and it is working fine.

Could you explain us what you are doing in your action of the button ?

arun_srinivasan
Contributor
0 Kudos

Hi

Change the property of value node <b>Singleton to false</b> initially it is true

Thanks and Regards,

Arun