Hi, I'd like to implement a form to edit elements of a collection. The contained list is fetched onActivate of the submit request as well, so the loop is marked as volatile.
The critical part, I'm not able to get to work, is where I add a new Element (virtually on client side) to the list. I do not want to add the colletion to the session because this is imho not where it belongs. It is much more to be passed from request to request. Just for the redirect after the post it should be passed through the flash scope. The adding of the new element is triggered by a button in the form (which has to be submitted fully as well to not loose any info that has been entered in paralllel). After the next Submit the collection is refeched from db (because volatile) and tapestry tries to update the collection with the content of the request, but since the collection in the request contains more elements than the one that got loaded, it throws a NoSuchElementException. How do I fix this without throwing the collection into the session ? The template: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <t:layout t:id="layout" title="Lorem ipsum" introHeading="Lorem ipsum" introText="Lorem ipsum" activePage="cms" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> <t:form t:id="update" t:clientValidation="false"> <ul> <li t:type="loop" t:source="collection" t:value="iter" t:volatile="true"> <h3>Element:</h3> <label for="position">input:</label> <t:textfield t:id="position" size="20" value="iter.position"/> </li> </ul> <t:submit t:id="addElement" t:value="add element" /> <t:submit t:id="save" t:value="save" /> </t:form> </t:layout> -------------------------------------------------------------- The page class: public class CollectionTest { @Inject private Facade _facade; @Inject private ComponentResources _resources; @Persist("flash") private List<Element> _collection; private Element iter; public void onActivate() { if ( _collection == null ) { collection = _facade.getCollection(..); } } public void cleanupRender() { _resources.discardPersistentFieldChanges(); } public void onSelectedFromAddElement() { _collection.add(new Element()); } public void onSelectedFromSave() { //_facade.store(_collection, ..); } public List<Element> getCollection() { return _collection; } public void setCollection(List<Element> collection) { _collection = collection; } public Element getIter() { return iter; } public void setIter(Element iter) { this.iter = iter; } } -- View this message in context: http://www.nabble.com/T5%3A-Dynamically-extending-volatile-list-tp17666544p17666544.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]