You need to postpone execution of your addition, the addition should
happen in the form submit method and not in the direct link.
This is very cumbersome part of T and almost every person hits this problem.
I ended up with 'delayed' method execution that I have described some
time ago, the core idea:
- direct link sets name of the method to execute via tag attribute,
- and then form submit method uses reflection to find the method and
execute it;
- this reflection-on-submit gets defined in the custom Page class that
will be a superclass for almost all my pages;
Marc A. Donis wrote:
sorry if this is a double post... not sure the first one went.
Hi. I'm new to Tapestry... trying hard to make a transition from WebObjects :)
Here's my problem:
I have a List of Strings through which I iterate, displaying one checkbox for
each item in the List. In the form's submit action method, I add an item to
the List. This is what happens after the first submit:
You have clicked on a stale link.
Rewind of form Home/$Form expected only 1 form elements, but an additional
id was requested by component Home/$Checkbox.
I suppose that the "1 form element" mentioned is the form's submit button.
Any hints/clues/suggestions? What am I doing wrong here?
Thanks!
The code:
public class Home extends BasePage {
private List<String> someList = new LinkedList<String>();
public String listElement;
public void formSubmit(IRequestCycle cycle) {
someList.add("hooohaw");
}
public boolean isCheckboxSelected() {
return true;
}
public void setCheckboxSelected(boolean val) {
}
public Iterator<String> getSomeList() {
// someList.add("hooohaw"); // putting this here instead of in
formSubmit results in the same error
return someList.iterator();
}
}
The HTML:
<html>
<body>
<form jwcid="@Form">
<input type="submit" jwcid="@Submit" value="Submit"
listener="ognl:listeners.formSubmit"/>
<span jwcid="@Foreach" source="ognl:someList" value="ognl:listElement"
>
<input type="checkbox" jwcid="@Checkbox"
selected="ognl:checkboxSelected"/>
</span>
<br/>
</form>
</body>
</html>
The environment:
JDK 1.5.0_02
Tapestry 3.0.3
Windows XP
Tomcat 5.5
--
Thanks,
Konstantin Ignatyev
http://www.kgionline.com
PS: If this is a typical day on planet earth, humans will add fifteen million
tons of carbon to the atmosphere, destroy 115 square miles of tropical
rainforest, create seventy-two miles of desert, eliminate between forty to one
hundred species, erode seventy-one million tons of topsoil, add 2.700 tons of
CFCs to the stratosphere, and increase their population by 263.000
Bowers, C.A. The Culture of Denial:
Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools.
New York: State University of New York Press, 1997: (4) (5) (p.206)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]