I should add that replacing the Loop with a Grid causes it to work as expected. Also, I notice that when I use a Loop, the setValue() being called is on a different instance of Keyword than the one used by the getter. As new is only called once, I gather the object used by the setter must be being created by the serialization mechanism.
Any further thoughts appreciated as this has me stumped. p. Quoting tapestryphoto <[EMAIL PROTECTED]>:
Hi, Bit of a simple query. I'm not sure what I'm doing wrong as I've followed the example given in the T5 component reference (bar using an encoder - my values are strings so I don't see why I should need one). I'm trying to implement a dynamic form where a user can add extra keyword fields. Adding works fine. Unfortunately when the form is submitted on Search none of the keyword values are updated with the entered values. Here is the markup: <form t:type="form" t:id="tagForm"> Tag: <select t:type="select" t:model="tags" t:value="tag" t:encoder="tags" t:blankOption="NEVER"></select> <p/> <t:loop source="allKeywords" value="keyword"> Keyword:<t:textfield t:id="keywordField" value="keyword.value"/> </t:loop> <t:submit t:id="search" value="Search"/> <t:submit t:id="add" value="Add"/> </form> Here is the page class: .... public class SearchByTag { @SuppressWarnings("unused") @Property @Persist private GenericSelectModel<Tag> tags; @SuppressWarnings("unused") @Property @Persist private Tag tag; @SuppressWarnings("unused") @Property @Persist private List<Value> searchResults; @SuppressWarnings("unused") @Property @Persist private Value listItem; @Property @Persist private List<Keyword> allKeywords; @Persist private Keyword keyword; @Inject private PropertyAccess propertyAccess; @Inject private MetadataRepository repository; public SearchByTag() { List<Tag> list = repository.getAllTags(); allKeywords = new ArrayList(); tags = new GenericSelectModel<Tag>(list,Tag.class,"name","id",propertyAccess); } public GenericSelectModel<Tag> getBeans() { return tags; } void onSelectedFromAdd() { allKeywords.add(new Keyword()); } Object onSuccess() { for (Keyword x: allKeywords) { System.out.println("VALUE ----> "+x.getValue()); } return this; } public Keyword getKeyword() { return keyword; } public void setKeyword(Keyword keyword) { this.keyword = keyword; } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]