cancel
Showing results for 
Search instead for 
Did you mean: 

binding input fields in form

Former Member
0 Kudos

Hey

I got a question with binding inputfields.

I got a table that is binded to my context. Under this table i got a button that opens a new VIEW with a form. This form is binded to the context. My problem is that old contextinput is still in the form if im using it serveral time. How is it possibple to "empty" the context? cause the fields in the forms has olds values

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Please post the context structure and the data binding of the UI elements.

Armin

Former Member
0 Kudos

Person

- name

- lastname

- email

And my UILements binding is

textfield1 Person.name

textfield2 Person.lastname

textfield3 Person.email

Former Member
0 Kudos

If you bind UI element properties to attributes inside a (multiple) node, you will always get the values for the lead-selected node element.

Armin

Former Member
0 Kudos

ahh,that makes sence..

so how whould you do this?

I got all the data stored in a oracle database. When i start the application, the data is stored in a context that is binded to a table. I got a button to create a new node to the context that represent a form. got any suggestions?

Former Member
0 Kudos

Not sure if I understand your use case correctly.

You have a table filled with data, you want to add a new entry by filling out a form?

In the action handler of the button, create and add a new node element, set the lead selection to the index of this element. Then you can use your existing data binding.

Armin

Former Member
0 Kudos

yes thats correct. I want to add a new entry by filling out a form..

I tried this code on the view with the table:

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

{

//@@begin onActiontoNewPersonView(ServerEvent)

IPersonNode bNode = wdContext.nodePerson();

IPersonElement bElement = bNode.createPersonElement();

bNode.addElement(bElement);

int leadSel = bNode.getLeadSelection();

if(leadSel == -1)

++leadSel;

bNode.setLeadSelection(leadSel);

wdThis.wdFirePlugToNewPersonView();

//@@end

}

But im still getting the old value

Former Member
0 Kudos

Simple set the lead selection to the index of the added element, like

bNode.moveTo(bElement.index());

Armin

Former Member
0 Kudos

Thany you Armin!

That solved my problem and saved my weekend!

Answers (2)

Answers (2)

Former Member
0 Kudos

thanx, but i cant find that method on the currentContextElement. This form is suppose to create a new element on the node, but each time i open the form, i get the last element i had opened on the form

former_member185029
Active Contributor
0 Kudos

Hi Kristoffer,

you put following code in your onPlugIn event.

wdContext.currentContextElement().setInputContext("");

That will solve your purpose.

Ashutosh