You're a useful fellow Jesse  :)

Now that you mention it, I specifically remember reading something
like that in Tapestry in Action.  I'll try it with a ListEdit.  Thanks
a lot.

On 8/17/05, Jesse Kuhnert <[EMAIL PROTECTED]> wrote:
> You might try using a ListEdit component instead, I think Foreach
> loops aren't safe inside forms, because they don't interact with the
> hidden form input fields that keep track of which components to
> expect...
> 
> jesse
> On 8/17/05, Scott Wadden <[EMAIL PROTECTED]> wrote:
> > Hey folks.  I'm really new to Tapestry, but it's definitely been a
> > pleasure to use thus far.  I'm a fairly experienced ASP.NET developer
> > who's recently converted to Java, but I felt like I was stepping back
> > into the dark ages with Struts and JSP.  I find myself missing .NET
> > less and less the more I use Tapestry however.
> >
> > Most of the stuff I've done so far has been pretty simple.  Fairly
> > static forms, and a couple of read only lists.  However, I've recently
> > run into problems trying to put form fields in a component that's
> > contained in a Foreach loop.  Basically, all the components seem to
> > given the state of the last component rendered.
> >
> > I've created a very simple demo that illustrates my problem.  It
> > consists of a component that contains a TextArea, and a property to
> > hold the TextArea's value.  My page simply outputs a bunch of these
> > inside of a loop.  First the component, TestList.jwc, with the doctype
> > removed:
> >
> > <component-specification>
> >     <property-specification name="messageBody" persistent="yes"/>
> >     <component id="newComp" type="TextArea">
> >         <binding name="value" expression="messageBody"/>
> >     </component>
> > </component-specification>
> >
> > Now the component's template, TestList.html:
> >
> > <span jwcid="newComp" />
> >
> > And finally the page template, Home.html:
> >
> > <html>
> >         <body>
> >             <form jwcid="@Form">
> >                         <div jwcid="@Foreach" source="ognl:{1, 2, 3, 4, 5}">
> >                                 <span jwcid="@TestList" />
> >                         </div>
> >                 <input type="submit" jwcid="@Submit" value="Submit form" />
> >             </form>
> >         </body>
> > </html>
> >
> > I tried this in 3.03 and 4.0b4 (with the appropriate changes of
> > course) and get exactly the same behavior. Whatever is in the final
> > text area gets put into the other 4 whenever I submit the form.  What
> > do I have to do to get my component to maintain its own state in this
> > sort of situation?
> >
> > Thank you very much,
> >
> > Scott
> >
> > ---------------------------------------------------------------------
> > 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