cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind a specific attribute of an element to an input field

Former Member
0 Kudos

HI,

in my web shop application I create an overview page of the items dynamically in the wdDoModify Method. Each item has it's own transparent container. I do not use tables or row repeaters, because they did not fullfill my requirements.

Now I have the problem to bind a specific attribute to an input field.

I bind the value with following code:

amountInput.bindValue(item.getAttributePointer("amount").getAttributeInfo())

item is the element of the item to display. amount is the attribute with type integer.

The problem is, that I have 4 Items on the screen. When I enter a value for amount, all amounts on the screen are the same. So I guess that the input field is not bound to the correct element.

Has anybody an idea what I have done wrong? Or which string for bindValue do I have to use for example for an attribute of the 5th element in a node?

Best regards,

Peter

Accepted Solutions (1)

Accepted Solutions (1)

i827647
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Peter, you have create the attribute to. You are doing reference to the same element, and your context node was selected to 1 element, than all fields that have bind to this attribute will set to value of the current element of context node.

Regards,

Edson Thomaz

Former Member
0 Kudos

HI,

item is always a different element. Do I have to select multiple elements in the context?

i827647
Product and Topic Expert
Product and Topic Expert
0 Kudos

Peter, you can set the context node to mutiple select, but you have to select it on item variable, like:

 
item = wdContext.nodeXXX.getElementAt(1);
amountInput.bindValue(item.getAttributePointer("amount").getAttributeInfo())

item = wdContext.nodeXXX.getElementAt(2);
amountInput2.bindValue(item.getAttributePointer("amount").getAttributeInfo())

Regards,

Edson Thomaz

Former Member
0 Kudos

That is the way i programmed this, but it does not work.

Best regards,

Peter

i827647
Product and Topic Expert
Product and Topic Expert
0 Kudos

Peter, you have another way to do this. You can dynamic create an attribute in context and bind this new attribute.

 
node.addAttribute(<<Field Name>>,<<Field Type>>);
amountInput2.bindValue(u201C<<node.field name>>u201D);

Regards,

Edson Thomaz

Former Member
0 Kudos

That was a good idea, I just created a new attribute dynamically, so my problems are solved

Answers (0)