In a page, I loop over a list of objects. In the page's template I specify an index parameter to track the loop like this:
<div t:type="loop" t:source="myList" t:value="iterationElement" t:index=" *elementIndex*"> <t:form t:id="formId" t:context="*elementIndex*"> <t:submit t:id="buttonId" value="Delete element" t:context="[*elementIndex*]" t:defer="false" /> In the page there is a property with the name "*elementIndex*". @Property > private int *elementIndex*; The event handler for the submit button click is @OnEvent(component = "buttonId", value = EventConstants.SELECTED) > private void deleteElement(Object[] context) { > int elementIndex = (Integer) context[0]; > // TODO Delete element > System.out.println("Deleting element with index: " + elementIndex); > } I also tried having this event handler method with an integer parameter only @OnEvent(component = "buttonId", value = EventConstants.SELECTED) > private void deleteElement(int elementIndex) { > // TODO Delete element > System.out.println("Deleting element with index: " + elementIndex); > } The thing is that I always get 0 ! My questions are: 1. How track the index of the iteration loop iteration and pass this index as a context to a submit button ? 2. Since I declared a form inside the loop, if a form is submitted, how can I use the loop's index to identify which element's form was submitted ? I think the context parameter is poorly documented. Also the different parameters for a single component are rarely given an example for. For instance, the Loop component documentation page <http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/corelib/components/Loop.html> doesn't give an example for the index parameter. Thank you *---------------------* *Muhammad Gelbana* http://www.linkedin.com/in/mgelbana