Hi, I'm currently working on a component which use a loop to render a list of fields dynamically. Following this is the structure of the component:
componentA.tml <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd" xmlns:p="tapestry:parameter"> <div style="height: 500px; overflow: scroll; overflow-x: hidden"> <t:loop t:source="properties" value="property" encoder="encoder" > <t:if test="case"> <t:delegate to="case" /> <!-- TEXT --> <t:block t:id="text"> <t:formfragment visible="printable"> <div class="form-group"> <t:label for="textField" class="col-sm-4 control-label" /> <div class="col-sm-8"> <input t:type="TextField" t:id="textField" value="property.second.defaultValue.rawValue" label="${label}" /> </div> </div> </t:formfragment> </t:block> </t:loop> </div> </t:container> ComponentA.java public class ComponentAextends { @Parameter(name = "properties", required = true) @Property protected List<ObjectPair<ObjectA, ObjectB>>> properties; @Property private ObjectPair<ObjectA, ObjectB> property; @Property private final ValueEncoder<ObjectPair<ObjectA, ObjectB>> encoder = new ValueEncoder<ObjectPair<ObjectA, ObjectB>>() { public String toClient( ObjectPair<ObjectA, ObjectB> namedKeyObject) { String clientValue = "-1"; if (namedKeyObject != null) { clientValue = String.valueOf(namedKeyObject.getFirst().getKey()); } return clientValue; } public ObjectPair<ObjectA,ObjectB> toValue( String key) { if (!Misc.isEmptyString(key) && !"-1".equals(key)) { long filterKey = Long.valueOf(key).longValue(); for (int i = 0; i < properties.size(); i++) { if (properties.get(i).getFirst().getKey() == filterKey) { return properties.get(i); } } } return null; } }; ... My problem is when I click in the button to send the values only the last field is coming filled, the other fields are coming null. I thought could be a problem with my encoder but I have seen that the encoder is working fine. Someone has any idea about this? Thank you, Robson Pires
