Well, have a look at ListEdit anyway, but I missed the essential problem that you're adding a new element onto the list. Konstantin is right--you have to add it later, in the submit method.

Jamie

Jamie Orchard-Hays wrote:
Marc, have a look at ListEdit and ListEditMap. Those are designed to deal with dynamic lists inside of a form.

Jamie

Marc A. Donis wrote:

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



---------------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to